@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,650&display=swap');

:root {
  color-scheme: dark;
  --forest-950: #0a2118;
  --forest-900: #0f2e21;
  --forest-800: #163c2b;
  --forest-600: #2d7653;
  --forest: #2F5D50;
  --climb: #176B52;
  --sage: #a9c9af;
  --cream: #FFFCF6;
  --gold: #d6ad60;
  --up: #7dd89c;
  --down: #f08b7f;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--cream);
  font-family: "DM Sans", system-ui, sans-serif;
  background:
    radial-gradient(circle at 15% 15%, rgba(45, 118, 83, .35), transparent 32rem),
    radial-gradient(circle at 90% 85%, rgba(214, 173, 96, .12), transparent 28rem),
    var(--forest-950);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .16;
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 70%);
}

.shell {
  width: min(1040px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(64px, 11vh, 120px) 0 40px;
}

.hero { max-width: 690px; }
.portal-nav {
  display: flex;
  margin: 0 0 40px;
  align-items: center;
  gap: 8px;
}
.portal-nav a {
  padding: 9px 14px;
  color: var(--cream);
  font-size: .86rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid rgba(255, 252, 246, .16);
  border-radius: 999px;
  background: rgba(47, 93, 80, .28);
  transition: border-color .2s, background .2s;
}
.portal-nav a:hover, .portal-nav a:focus-visible, .portal-nav a[aria-current="page"] {
  border-color: var(--climb);
  background: var(--climb);
  outline: none;
}
.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2.7rem, 7vw, 5.3rem);
  line-height: .98;
  letter-spacing: -.04em;
}

.intro {
  margin: 24px 0 0;
  color: var(--sage);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.65;
}

.ota-section, .builds-section {
  margin-top: clamp(48px, 8vh, 76px);
}
.section-heading { max-width: 720px; }
.section-heading h2 {
  margin: 0;
  color: var(--cream);
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  line-height: 1.05;
  letter-spacing: -.025em;
}
.section-heading > p:last-child {
  margin: 14px 0 0;
  color: var(--sage);
  line-height: 1.6;
}
.ota-section {
  padding: clamp(24px, 4vw, 38px);
  border: 1px solid rgba(255, 252, 246, .14);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(47, 93, 80, .82), rgba(23, 107, 82, .42));
  box-shadow: 0 24px 60px rgba(0, 0, 0, .2);
}
.ota-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
}
.ota-app {
  display: flex;
  min-height: 80px;
  padding: 16px;
  color: var(--cream);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-decoration: none;
  border: 1px solid rgba(255, 252, 246, .18);
  border-radius: 14px;
  background: rgba(10, 33, 24, .45);
  transition: transform .2s, border-color .2s, background .2s;
}
.ota-app span { font-weight: 700; }
.ota-app strong { color: var(--up); font-size: .78rem; }
.ota-app:hover, .ota-app:focus-visible {
  transform: translateY(-2px);
  border-color: var(--up);
  background: var(--climb);
  outline: none;
}

.services {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.card {
  display: flex;
  min-height: 290px;
  padding: 28px;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  flex-direction: column;
  border: 1px solid rgba(169, 201, 175, .17);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(22, 60, 43, .92), rgba(15, 46, 33, .78));
  box-shadow: 0 24px 60px rgba(0, 0, 0, .2);
  transition: transform .22s ease, border-color .22s ease, background .22s ease;
}

.card:hover, .card:focus-visible {
  transform: translateY(-5px);
  border-color: rgba(214, 173, 96, .65);
  background: linear-gradient(145deg, rgba(28, 76, 54, .96), rgba(15, 46, 33, .85));
  outline: none;
}

.card-top { display: flex; align-items: center; justify-content: space-between; }
.icon {
  display: grid;
  width: 45px;
  height: 45px;
  place-items: center;
  color: var(--forest-950);
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  border-radius: 13px;
  background: var(--gold);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  color: var(--sage);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  border: 1px solid rgba(169, 201, 175, .16);
  border-radius: 99px;
  background: rgba(7, 29, 20, .42);
}

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.up { color: var(--up); }
.status.down { color: var(--down); }
.status.checking .dot { animation: blink 1s ease-in-out infinite; }

.card-copy { display: flex; margin-top: 44px; flex-direction: column; gap: 10px; }
.card-copy strong { font-family: "Fraunces", Georgia, serif; font-size: 1.75rem; }
.card-copy strong a { color: inherit; text-decoration: none; }
.card-copy strong a:hover { color: var(--gold); }
.card-copy span { max-width: 330px; color: var(--sage); line-height: 1.55; }
.open { display: flex; color: var(--gold); font-size: .9rem; font-weight: 600; justify-content: space-between; text-decoration: none; }

.build-card { min-height: 320px; }
.card-actions { display: flex; margin-top: auto; align-items: center; justify-content: space-between; gap: 14px; }
.ota-actions { width: 100%; margin-top: 8px; flex-direction: column; }
.ota-install-link { display: block; width: 100%; padding: 10px 16px; text-align: center; color: var(--forest-950); font: inherit; font-size: .86rem; font-weight: 700; background: var(--up); border: none; border-radius: 12px; text-decoration: none; cursor: pointer; transition: filter .2s; }
.ota-install-link:hover { filter: brightness(1.15); }
.rebuild-button, .secondary-button {
  display: inline-flex;
  min-height: 42px;
  padding: 10px 16px;
  color: var(--forest-950);
  font: inherit;
  font-size: .86rem;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gold);
  border-radius: 12px;
  background: var(--gold);
  cursor: pointer;
  text-decoration: none;
}
.secondary-button { color: var(--gold); background: transparent; }
.rebuild-button:hover:not(:disabled), .secondary-button:hover { filter: brightness(1.12); }
.rebuild-button:focus-visible, .secondary-button:focus-visible { outline: 3px solid rgba(214, 173, 96, .35); outline-offset: 2px; }
.rebuild-button:disabled { opacity: .55; cursor: not-allowed; }
.rebuild-button.is-building::before {
  content: "";
  width: 13px;
  height: 13px;
  margin-right: 8px;
  border: 2px solid rgba(10, 33, 24, .35);
  border-top-color: var(--forest-950);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.build-status { margin: 18px 0 0; color: var(--sage); font-size: .84rem; line-height: 1.5; }
.build-status.done { color: var(--up); }
.build-status.error { color: var(--down); }
.build-detail {
  margin-top: clamp(42px, 7vh, 70px);
  padding: 28px;
  border: 1px solid rgba(169, 201, 175, .17);
  border-radius: 22px;
  background: rgba(15, 46, 33, .78);
}
.detail-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.ota-button { background: var(--up) !important; color: var(--forest-950) !important; border-color: var(--up) !important; }
.build-logs {
  max-height: 540px;
  margin: 24px 0 0;
  padding: 18px;
  overflow: auto;
  color: #dbe8de;
  font: .76rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-radius: 12px;
  background: rgba(5, 20, 14, .8);
}

footer {
  display: flex;
  margin-top: 28px;
  color: rgba(169, 201, 175, .65);
  font-size: .76rem;
  align-items: center;
  gap: 8px;
}
.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 5px rgba(125,216,156,.1); }
.separator { opacity: .5; }

@keyframes blink { 50% { opacity: .3; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 840px) {
  .ota-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .shell { width: min(100% - 28px, 520px); padding-top: 32px; }
  .portal-nav { margin-bottom: 32px; overflow-x: auto; }
  .ota-grid { grid-template-columns: 1fr; }
  .ota-app { min-height: 66px; }
  .services { grid-template-columns: 1fr; margin-top: 24px; }
  .card { min-height: 250px; }
  footer { flex-wrap: wrap; }
  .separator { display: none; }
  #last-check { width: 100%; padding-left: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
