/* ============================================================================
   MERIDIAN — secure gateway
   The sign-in / password-reset surface, and the shared chrome it uses:
   a layered dark field, a fixed header, and the portal card.

   Palette and tokens come from main.css. Gold is used only where it carries
   meaning (focus, primary action, the live bulb).
   ========================================================================== */

:root {
  --gw-gold: #c8a45c;
  --gw-gold-hi: #e3c583;
  --gw-ease: cubic-bezier(.22, 1, .36, 1);
}

/* ======================================================== body & layers */
.gw-body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* the drawn field behind everything */
.gw-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.gw-bg canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* structural grid */
.gw-lattice {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(232, 234, 237, .020) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 234, 237, .020) 1px, transparent 1px);
  background-size: 68px 68px;
  mask-image: radial-gradient(ellipse 100% 80% at 50% 20%, #000 10%, transparent 76%);
  -webkit-mask-image: radial-gradient(ellipse 100% 80% at 50% 20%, #000 10%, transparent 76%);
}

/* fine film grain */
.gw-grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: .5;
  background-image: repeating-linear-gradient(
    0deg, rgba(255,255,255,.012) 0 1px, transparent 1px 3px);
}

/* edge falloff */
.gw-vignette {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(ellipse 90% 75% at 50% 42%, transparent 42%, rgba(7, 7, 8, .82) 100%);
}

/* a single slow scanline sweep */
.gw-scan {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, rgba(232, 234, 237, .022) 48%, transparent 52%);
  height: 40vh;
  top: -40vh;
  animation: gw-scan 14s linear infinite;
}
@keyframes gw-scan {
  from { top: -40vh; }
  to   { top: 110vh; }
}

/* one hairline held across the page */
.gw-rule {
  position: fixed;
  left: 0; right: 0;
  top: 74px;
  height: 1px;
  z-index: 5;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(232, 234, 237, .10) 18%, rgba(232, 234, 237, .10) 82%, transparent);
}

/* ============================================================ header */
.gw-top {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 30px 16px;
  max-width: 1440px;
  margin: 0 auto;
}

.gw-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}
.gw-brand img {
  width: 30px; height: 30px;
  flex: 0 0 30px;
  transition: transform .5s var(--gw-ease);
}
.gw-brand:hover img { transform: rotate(-12deg) scale(1.08); }
.gw-brand .word {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .2em;
  line-height: 1.2;
}
.gw-brand .sub {
  display: block;
  font-size: 9.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
}

/* live status */
.gw-live {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 30px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, .03);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--dim);
  transition: color .3s ease, border-color .3s ease;
}
.gw-live .bulb {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--faint);
  flex: 0 0 6px;
  transition: background .3s ease, box-shadow .3s ease;
}
.gw-live .txt { white-space: nowrap; }
.gw-live[data-state="idle"] .bulb { background: var(--faint); }
.gw-live[data-state="working"] {
  color: var(--gw-gold);
  border-color: rgba(200, 164, 92, .35);
}
.gw-live[data-state="working"] .bulb {
  background: var(--gw-gold);
  box-shadow: 0 0 10px rgba(200, 164, 92, .9);
  animation: gw-blink 1.4s ease-in-out infinite;
}
.gw-live[data-state="ok"] { color: var(--ok); border-color: rgba(143, 208, 172, .35); }
.gw-live[data-state="ok"] .bulb { background: var(--ok); box-shadow: 0 0 10px rgba(143, 208, 172, .9); }
.gw-live[data-state="err"] { color: var(--accent); border-color: rgba(212, 81, 124, .4); }
.gw-live[data-state="err"] .bulb { background: var(--accent); box-shadow: 0 0 10px rgba(212, 81, 124, .9); }
@keyframes gw-blink { 0%, 100% { opacity: 1; } 50% { opacity: .32; } }

.gw-top .spacer { margin-left: auto; }

.gw-topnav { display: flex; align-items: center; gap: 6px; }
.gw-navlink {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  color: var(--dim);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .02em;
  transition: color .26s ease, background .26s ease, border-color .26s ease, transform .26s var(--gw-ease);
}
.gw-navlink svg { width: 14px; height: 14px; }
.gw-navlink:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, .05);
  border-color: var(--line-2);
  transform: translateY(-1px);
}
.gw-navlink.is-key { color: var(--silver); border-color: var(--line-3); }
.gw-navlink.is-key:hover { color: var(--gw-gold-hi); border-color: rgba(200, 164, 92, .45); background: rgba(200, 164, 92, .08); }

/* ============================================================ stage */
.gw-stage {
  position: relative;
  z-index: 6;
  max-width: 1440px;
  margin: 0 auto;
  padding: 34px 30px 70px;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr);
  gap: clamp(28px, 4vw, 64px);
  align-items: start;
}

/* --------------------------------------------------- editorial column */
.gw-aside { min-width: 0; }

.kicker {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 22px;
}

.gw-aside h1 {
  margin: 0 0 22px;
  font-size: clamp(30px, 4.1vw, 50px);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -.025em;
  color: var(--ink);
  max-width: 17ch;
}
.gw-aside h1 .dim { color: var(--faint); }

.gw-lede {
  margin: 0 0 26px;
  max-width: 56ch;
  font-size: 14.5px;
  line-height: 1.78;
  color: var(--dim);
}

.gw-claim {
  margin: 0 0 34px;
  max-width: 46ch;
  padding-left: 18px;
  border-left: 1px solid rgba(200, 164, 92, .5);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.62;
  color: var(--silver);
  font-style: italic;
}

/* spec table — a tidy 2x2 rather than an auto-fit that leaves an orphan cell */
.gw-specs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--line);
}
.gw-spec {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  background: rgba(12, 13, 16, .8);
}
.gw-spec .k {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--faint);
}
.gw-spec .v { font-size: 13px; color: var(--silver); }
.gw-spec .v em { font-style: normal; color: var(--silver); }
.gw-spec .v em.warn { color: var(--warn); }

/* manifest */
.gw-manifest { display: flex; flex-direction: column; gap: 2px; }
.gw-item {
  display: flex;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  transition: transform .3s var(--gw-ease);
}
.gw-item:last-child { border-bottom: 1px solid var(--line); }
.gw-item:hover { transform: translateX(4px); }
.gw-item .idx {
  flex: 0 0 auto;
  width: 26px;
  padding-top: 2px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--gw-gold);
  letter-spacing: .04em;
}
.gw-item h3 {
  margin: 0 0 5px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--ink);
}
.gw-item p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.66;
  color: var(--dim);
  max-width: 52ch;
}

/* ---------------------------------------------------------- the portal */
.gw-portal-wrap { position: relative; }
.gw-portal-wrap::before {
  content: "";
  position: absolute;
  inset: -2% -6%;
  z-index: -1;
  border-radius: 40px;
  background: radial-gradient(60% 60% at 50% 0%, rgba(200, 164, 92, .09), transparent 70%);
  filter: blur(30px);
}

.gw-portal {
  border: 1px solid var(--line-2);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(20, 23, 28, .92), rgba(10, 11, 13, .96));
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .04);
  overflow: hidden;
}

.gw-portal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.gw-portal-head .mark img { width: 26px; height: 26px; display: block; }
.gw-portal-head .who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gw-portal-head .name {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .2em;
  color: var(--ink);
}
.gw-portal-head .role {
  font-size: 9px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--faint);
}
.gw-stages { display: inline-flex; gap: 5px; margin-left: auto; }
.gw-stages .dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  transition: background .3s ease, box-shadow .3s ease;
}
.gw-stages .dot.on {
  background: var(--gw-gold);
  box-shadow: 0 0 8px rgba(200, 164, 92, .85);
}

.gw-portal-body { padding: 26px 22px 24px; }

/* notice strip */
.gw-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid rgba(212, 81, 124, .35);
  background: rgba(212, 81, 124, .10);
  font-size: 12.5px;
  line-height: 1.5;
  color: #f0a2ba;
  animation: gw-rise .45s var(--gw-ease) both;
}
.gw-notice[hidden] { display: none !important; }
.gw-notice svg { width: 16px; height: 16px; flex: 0 0 16px; }

/* mode panels */
.gw-mode { display: none; }
.gw-mode.is-active { display: block; animation: gw-rise .5s var(--gw-ease) both; }
@keyframes gw-rise {
  from { opacity: 0; transform: translate3d(0, 14px, 0); }
  to   { opacity: 1; transform: none; }
}

.gw-h1 {
  margin: 0 0 7px;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -.01em;
  color: var(--ink);
}
.gw-sub {
  margin: 0 0 22px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--dim);
}

/* ------------------------------------------------------------- fields */
.gw-form { display: flex; flex-direction: column; gap: 16px; }

.gw-field { display: flex; flex-direction: column; gap: 7px; }
.gw-field > label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: var(--faint);
  transition: color .26s ease;
}
.gw-field:focus-within > label { color: var(--gw-gold); }

.gw-inputwrap {
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: rgba(255, 255, 255, .025);
  transition: border-color .26s ease, background .26s ease, box-shadow .26s ease;
}
.gw-inputwrap:hover { border-color: var(--line-3); }
.gw-field:focus-within .gw-inputwrap {
  border-color: rgba(200, 164, 92, .55);
  background: rgba(200, 164, 92, .05);
  box-shadow: 0 0 0 4px rgba(200, 164, 92, .09);
}
.gw-field[data-invalid="1"] .gw-inputwrap {
  border-color: rgba(212, 81, 124, .6);
  background: rgba(212, 81, 124, .06);
}

.gw-glyph {
  width: 16px; height: 16px;
  flex: 0 0 16px;
  margin: 0 11px;
  color: var(--faint);
  transition: color .26s ease;
}
.gw-field:focus-within .gw-glyph { color: var(--gw-gold); }

.gw-input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 14px 0 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
}
.gw-input::placeholder { color: rgba(95, 101, 110, .7); }

.gw-trailing {
  display: grid;
  place-items: center;
  width: 40px;
  height: 44px;
  margin-right: 2px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 9px 9px 0;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  transition: color .24s ease, background .24s ease;
}
.gw-trailing:hover { color: var(--gw-gold); background: rgba(255, 255, 255, .04); }
.gw-trailing[hidden] { display: none; }
.gw-trailing svg { width: 17px; height: 17px; }

/* per-field error text */
.gw-msg {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  line-height: 1.5;
  color: #f0a2ba;
}
.gw-msg svg { width: 13px; height: 13px; flex: 0 0 13px; }
.gw-field[data-invalid="1"] .gw-msg { display: flex; animation: gw-rise .3s var(--gw-ease) both; }

/* ------------------------------------------------------------ actions */
.gw-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }

.gw-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 46px;
  padding: 0 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  background-image:
    linear-gradient(150deg, rgba(200, 164, 92, .28), rgba(138, 107, 52, .16)),
    linear-gradient(150deg, rgba(227, 197, 131, .55), rgba(200, 164, 92, .26));
  background-origin: border-box;
  background-clip: padding-box, border-box;
  color: #f7ecd8;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .06em;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16);
  transition: transform .3s var(--gw-ease), box-shadow .3s ease, opacity .2s ease;
}
.gw-btn::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: -140%;
  width: 48%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .18), transparent);
  transform: skewX(-18deg);
  pointer-events: none;
}
.gw-btn:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .24), 0 16px 32px -18px rgba(200, 164, 92, .85);
}
.gw-btn:hover::before { animation: gw-sheen .85s var(--gw-ease) forwards; }
@keyframes gw-sheen { to { left: 165%; } }
.gw-btn:active { transform: translateY(0) scale(.99); }
.gw-btn:focus-visible { outline: 2px solid var(--gw-gold); outline-offset: 3px; }
.gw-btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.gw-btn svg { width: 16px; height: 16px; }

.gw-btn.ghost {
  background-image:
    linear-gradient(150deg, rgba(30, 32, 34, .7), rgba(12, 13, 16, .8)),
    linear-gradient(150deg, rgba(232, 234, 237, .18), rgba(120, 130, 145, .07));
  color: var(--silver);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}
.gw-btn.ghost:hover { color: var(--ink); box-shadow: inset 0 1px 0 rgba(255,255,255,.09), 0 14px 28px -18px rgba(0,0,0,.9); }

.gw-textbtn {
  align-self: center;
  padding: 4px 2px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--dim);
  font: inherit;
  font-size: 11.5px;
  letter-spacing: .03em;
  cursor: pointer;
  transition: color .26s ease, border-color .26s ease;
}
.gw-textbtn:hover { color: var(--gw-gold-hi); border-bottom-color: rgba(200, 164, 92, .45); }
.gw-textbtn:focus-visible { outline: 2px solid var(--gw-gold); outline-offset: 3px; }

/* progress readout under the form */
.gw-boot {
  margin-top: 14px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--faint);
}
.gw-boot:empty { display: none; }

/* --------------------------------------------------------- sent panel */
.gw-sent { text-align: center; padding: 8px 0 4px; }
.gw-sent .glyph {
  display: grid;
  place-items: center;
  width: 48px; height: 48px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 1px solid rgba(143, 208, 172, .4);
  background: rgba(143, 208, 172, .1);
  color: var(--ok);
}
.gw-sent .glyph svg { width: 22px; height: 22px; }
.gw-sent h2 { margin: 0 0 10px; font-size: 18px; font-weight: 500; color: var(--ink); }
.gw-sent p {
  margin: 0 0 18px;
  font-size: 12.5px;
  line-height: 1.68;
  color: var(--dim);
}
.gw-sent .mask {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  padding: 9px 14px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, .025);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--silver);
}
.gw-sent .mask .k {
  font-family: var(--font);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--faint);
}
.gw-sent .acts { display: flex; justify-content: center; }

/* ------------------------------------------------------------- footer */
.gw-divider {
  margin: 26px 0 14px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--faint);
  text-align: center;
}
.gw-foot-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.7;
  color: var(--dim);
  text-align: center;
}
.gw-foot-note a { color: var(--gw-gold); text-decoration: none; border-bottom: 1px solid rgba(200, 164, 92, .35); }
.gw-foot-note a:hover { color: var(--gw-gold-hi); }

/* ------------------------------------------------------------ stagger */
.gw-rise { animation: gw-rise .8s var(--gw-ease) both; }
.gw-d1 { animation-delay: .06s; }
.gw-d2 { animation-delay: .14s; }
.gw-d3 { animation-delay: .22s; }
.gw-d4 { animation-delay: .30s; }
.gw-d5 { animation-delay: .38s; }
.gw-d6 { animation-delay: .46s; }

/* ------------------------------------------------------------- footer */
.gw-foot {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px 30px 30px;
  border-top: 1px solid var(--line);
  font-size: 10.5px;
  letter-spacing: .06em;
  color: var(--faint);
}
.gw-foot .c { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.gw-foot .mono { font-family: var(--mono); letter-spacing: .1em; }
.gw-foot a {
  color: var(--dim);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color .26s ease, border-color .26s ease;
}
.gw-foot a:hover { color: var(--gw-gold); border-bottom-color: rgba(200, 164, 92, .4); }

/* ---------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .gw-stage { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .gw-aside h1 { max-width: none; }
  .gw-portal-wrap { max-width: 560px; }
}

@media (max-width: 720px) {
  .gw-top { padding: 14px 16px; gap: 10px; }
  .gw-live { display: none; }
  .gw-navlink span { display: none; }
  .gw-navlink { padding: 0 11px; }
  .gw-stage { padding: 20px 16px 50px; }
  .gw-portal-body { padding: 22px 18px 20px; }
  .gw-foot { padding: 16px; }
  .gw-rule { top: 62px; }
  .gw-scan { display: none; }
}

/* ------------------------------------------------------ reduced motion */
@media (prefers-reduced-motion: reduce) {
  .gw-scan { display: none; }
  .gw-rise, .gw-mode.is-active, .gw-notice { animation: none !important; }
  .gw-btn::before { display: none; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}