/* Gated write-ups, sign-in and Vetted requests. Loaded only on those pages.
   Every class is g- prefixed so nothing here can restyle the rest of the site.
   Tokens follow the round-3 spec (AA on --bg); Night keeps the red palette. */
:root {
  --g-label: #5fa9d3;
  --g-faint: #8593a0;
  --g-ok: #3ddc84;
  --g-field: #080b0e;
  --g-field-line: #66727e;
  --g-placeholder: #7d8995;
  --g-amber: var(--warn);
  --g-ease: cubic-bezier(.2, .7, .2, 1);
}
:root[data-theme="night"] {
  --g-label: #e0806f;
  --g-faint: #a8817a;
  --g-ok: #ffab6b;
  --g-field: #070404;
  --g-field-line: #7a4d45;
  --g-placeholder: #9a736c;
}

.g-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.g-lock { width: 18px; height: 18px; flex: none; }

/* ---- frame (corner brackets) ---- */
.g-frame {
  position: relative;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--rule-strong);
}
.g-frame::before, .g-frame::after {
  content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none;
}
.g-frame::before { top: -1px; left: -1px; border-top: 2px solid var(--ph); border-left: 2px solid var(--ph); }
.g-frame::after { bottom: -1px; right: -1px; border-bottom: 2px solid var(--ph); border-right: 2px solid var(--ph); }
.g-frame-title {
  font-family: var(--display); font-weight: 900; text-transform: uppercase;
  color: var(--metal-hi); font-size: 1.2rem; line-height: 1.1; margin: 0 0 1rem;
  overflow-wrap: anywhere;
}

.g-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.g-actions .btn { flex: 1 1 11rem; min-height: 48px; justify-content: center; }

/* ---- project page (A) ---- */
.g-layout { display: grid; gap: 2rem; padding-top: 1.5rem; padding-bottom: 2rem; }
.g-prose { max-width: 40rem; min-width: 0; }
.g-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase;
  padding: .1rem .45rem; border: 1px solid var(--g-amber); color: var(--g-amber);
}
.g-chip .g-lock { width: 12px; height: 12px; }
.g-chip.is-open { border-color: var(--ph-dim); color: var(--ph); }
.g-still {
  margin: 0 0 1.5rem; border: 1px solid var(--rule-strong); background: var(--panel);
  aspect-ratio: 16 / 9; overflow: hidden;
}
.g-still img { display: block; width: 100%; height: 100%; object-fit: contain; }
.g-try { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }
.g-try a { min-height: 44px; display: inline-flex; align-items: center; }

.g-locked { position: relative; margin-top: .5rem; }
.g-fade { position: relative; max-height: 13rem; overflow: hidden; user-select: none; }
.g-fade p { filter: blur(4px); opacity: .55; margin: 0 0 1rem; }
.g-fade::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent, var(--bg) 85%);
}
.g-gate { margin-top: -4rem; padding: 1.5rem 1rem; }
.g-gate h2 {
  font-family: var(--display); font-weight: 900; text-transform: uppercase;
  color: var(--metal-hi); font-size: 1.35rem; line-height: 1.05; margin: 0 0 .6rem;
  display: flex; gap: .6rem; align-items: center; letter-spacing: 0;
}
.g-gate h2 .g-lock { color: var(--g-amber); }
.g-gate p { color: var(--ink-soft); font-size: .88rem; margin: 0 0 1rem; }

/* #continue is only ever focused by script, to move screen readers to the cut. */
.g-body:focus, .g-body:focus-visible { outline: none; }
[data-handle] { text-transform: none; }

.g-vetted {
  margin-top: 2rem; padding: 1rem; border: 1px solid var(--rule-strong);
  border-left: 2px solid var(--g-amber); background: var(--panel);
}
.g-vetted h2 {
  display: flex; align-items: center; gap: .6rem; margin: 0 0 .9rem;
  font-family: var(--mono); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink);
}
.g-vetted h2 .g-lock { color: var(--g-amber); }
.g-vetted .g-actions .btn { flex: 0 1 auto; }
.g-pending {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 44px;
  padding: 0 .8rem; border: 1px solid var(--g-amber); color: var(--g-amber);
  font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
}
.g-assets { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.g-assets a { min-height: 44px; display: inline-flex; align-items: center; }
.g-vetted-note { margin: 0; color: var(--ink-soft); }

/* ---- ladder ---- */
.g-side { min-width: 0; }
.g-side-title {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--g-faint); margin: 0 0 .75rem; font-weight: 400;
}
.g-ladder { list-style: none; margin: 0; padding: 0; border: 1px solid var(--rule-strong); }
.g-rung {
  display: grid; grid-template-columns: 28px 1fr; gap: .75rem;
  padding: .75rem 1rem; border-bottom: 1px solid var(--rule); font-size: .82rem; line-height: 1.5;
}
.g-rung:last-child { border-bottom: 0; }
.g-rung b {
  display: block; color: var(--ink); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase;
}
.g-rung span { color: var(--ink-soft); }
.g-rung i {
  font-style: normal; display: grid; place-items: center; width: 24px; height: 24px;
  border: 1px solid var(--rule-strong); font-size: .7rem; color: var(--g-faint);
}
.g-rung.is-held { background: var(--ph-ghost); }
.g-rung.is-held i { border-color: var(--ph); color: var(--ph); }
.g-rung.is-pending i, .g-rung.is-approved i { border-color: var(--g-amber); color: var(--g-amber); }
.g-rung.is-approved { background: rgba(255, 179, 0, .06); }
.g-note { margin: 0 0 1.5rem; }
.g-note p { margin: 0; }

/* ---- forms (B, C) ---- */
.g-form-layout { display: grid; gap: 1.5rem; padding-top: 1.5rem; padding-bottom: 2rem; }
.g-main { min-width: 0; }
.g-context {
  display: flex; gap: .75rem; align-items: center; margin: 0 0 1.25rem;
  padding: .7rem 1rem; border: 1px solid var(--rule-strong); border-left: 2px solid var(--ph);
  background: var(--panel); font-size: .82rem; color: var(--ink-soft);
}
.g-context b { color: var(--ink); font-weight: 700; }
.g-context .g-lock { color: var(--ph); }
.g-flash {
  margin: 0 0 1rem; padding: .6rem .9rem; border: 1px solid var(--ph-dim);
  color: var(--ph); font-size: .82rem;
}
.g-tabs { display: flex; gap: .5rem; margin: 0 0 1.5rem; }
.g-tabs a {
  flex: 1; display: inline-flex; justify-content: center; align-items: center; min-height: 48px;
  font-family: var(--mono); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase;
  border: 1px solid var(--rule-strong); color: var(--ink-soft); text-decoration: none; text-align: center;
  padding: 0 .5rem;
}
.g-tabs a[aria-current] { background: var(--ph); color: #000; border-color: var(--ph); }
.g-form { display: grid; gap: 1rem; }
.g-field { display: grid; gap: .35rem; }
.g-field label {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--g-label); font-weight: 700;
}
.g-opt { color: var(--g-faint); font-weight: 400; letter-spacing: .06em; text-transform: none; }
.g-field input, .g-field textarea {
  font: inherit; font-family: var(--mono); font-size: 16px; color: var(--ink);
  background: var(--g-field); border: 1px solid var(--g-field-line); border-radius: 0;
  min-height: 48px; padding: .6rem .8rem; width: 100%; box-sizing: border-box;
}
.g-field textarea { min-height: 8.5rem; resize: vertical; line-height: 1.55; }
.g-field input:focus, .g-field textarea:focus { outline: 2px solid var(--ph); outline-offset: 1px; border-color: var(--ph); }
.g-field input::placeholder, .g-field textarea::placeholder { color: var(--g-placeholder); opacity: 1; }
.g-field input[readonly], .g-field textarea[readonly] { opacity: .7; }
.g-field [aria-invalid="true"] { border-color: var(--alarm); }
.g-hint { font-size: .74rem; color: var(--g-faint); line-height: 1.5; margin: 0; }
.g-err { font-size: .78rem; color: var(--alarm); margin: 0; line-height: 1.45; }
.g-counter { justify-self: end; font-size: .7rem; color: var(--g-faint); margin: 0; }
.g-counter.is-over { color: var(--alarm); }
.g-pw { display: grid; grid-template-columns: 1fr 44px; }
.g-pw input { border-right: 0; }
.g-eye {
  width: 44px; min-height: 48px; display: grid; place-items: center; cursor: pointer;
  background: var(--g-field); border: 1px solid var(--g-field-line); color: var(--ink-soft);
}
.g-eye svg { width: 20px; height: 20px; }
.g-eye[aria-pressed="true"] { color: var(--ph); }
.g-summary {
  border: 1px solid var(--alarm); border-left-width: 3px; padding: .75rem 1rem;
  background: var(--panel); color: var(--ink); font-size: .84rem;
}
.g-summary:focus { outline: 2px solid var(--alarm); outline-offset: 2px; }
.g-summary p { margin: 0 0 .35rem; font-weight: 700; color: var(--alarm); }
.g-summary ul { margin: 0; padding-left: 1.1rem; }
.g-summary a { color: var(--ink); text-decoration: underline; }
.g-submit { min-height: 48px; justify-content: center; display: inline-flex; align-items: center; gap: .6rem; }
.g-submit[aria-busy="true"], .g-submit[aria-disabled="true"] { cursor: progress; }
.g-spin {
  width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; display: inline-block; flex: none;
}
.g-panel { padding: 1.5rem 1rem; }

/* ---- status (D) ---- */
.g-skeleton { min-height: 12rem; border: 1px dashed var(--rule-strong); }
.g-badge {
  display: inline-flex; align-items: center; gap: .55rem; margin: 0 0 1rem;
  font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--g-amber); border: 1px solid var(--g-amber); padding: .3rem .6rem;
}
.g-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.g-badge.is-approved { color: var(--g-amber); }
.g-badge.is-declined { color: var(--ink-soft); border-color: var(--rule-strong); }
.g-steps { list-style: none; margin: 1.5rem 0; padding: 0; }
.g-steps li { display: grid; grid-template-columns: 32px 1fr; gap: .75rem; padding-bottom: 1rem; position: relative; }
.g-steps li::before {
  content: ""; position: absolute; left: 11px; top: 26px; bottom: 2px; width: 2px; background: var(--rule-strong);
}
.g-steps li:last-child::before { display: none; }
.g-steps i {
  font-style: normal; width: 24px; height: 24px; display: grid; place-items: center;
  border: 1px solid var(--rule-strong); font-size: .72rem; color: var(--g-faint);
  background: var(--bg); position: relative;
}
.g-steps .is-done i { background: var(--ph); border-color: var(--ph); color: #000; }
.g-steps .is-now i { border-color: var(--g-amber); color: var(--g-amber); }
.g-steps .is-vetted i { background: var(--g-amber); border-color: var(--g-amber); color: #000; }
.g-steps b { display: block; font-size: .84rem; color: var(--ink); }
.g-steps span { display: block; font-size: .8rem; color: var(--ink-soft); }
.g-reason { margin: 0 0 1rem; }
.g-readback {
  display: grid; gap: .2rem; font-size: .8rem; border-top: 1px solid var(--rule);
  padding-top: 1rem; margin: 0 0 1.5rem; color: var(--ink-soft);
}
.g-readback div { display: grid; grid-template-columns: 8.5rem 1fr; gap: .75rem; }
.g-readback dt { color: var(--g-faint); text-transform: uppercase; letter-spacing: .1em; font-size: .68rem; }
.g-readback dd { margin: 0; overflow-wrap: anywhere; }
.g-status p { overflow-wrap: anywhere; }

@media (max-width: 30rem) {
  .g-readback div { grid-template-columns: 1fr; gap: 0; }
}
@media (min-width: 60rem) {
  .g-layout { grid-template-columns: minmax(0, 40rem) 18rem; justify-content: space-between; padding-top: 2rem; }
  .g-form-layout { grid-template-columns: minmax(0, 32rem) 20rem; justify-content: space-between; padding-top: 2rem; }
  .g-side { position: sticky; top: 1rem; align-self: start; }
  .g-gate { padding: 2rem; }
  .g-panel { padding: 2rem; }
}

/* Motion only for people who have not asked for less. */
@keyframes g-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes g-spin { to { transform: rotate(360deg); } }
@keyframes g-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@media (prefers-reduced-motion: no-preference) {
  .g-gate, .g-body.is-open { animation: g-rise .5s var(--g-ease) both; }
  .g-spin { animation: g-spin .8s linear infinite; }
  .g-badge .g-dot { animation: g-pulse 2.4s ease-in-out infinite; }
  .g-actions .btn { transition: transform .18s var(--g-ease), box-shadow .18s var(--g-ease); }
}
@media (prefers-reduced-motion: reduce) {
  .g-spin { border: 0; width: auto; height: auto; }
  .g-spin::before { content: "…"; }
}


/* Spec 7.8: Turnstile loading placeholder, 300x65 with a dashed border,
   until the widget's iframe lands in the slot. */
.g-form .turnstile-slot:empty {
  width: 300px; max-width: 100%; height: 65px; border: 1px dashed var(--rule-strong);
}
/* Spec 8: button press, 120ms translateY(1px); none under reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  .g-form .g-submit:active, .g-actions .btn:active, .g-gate .btn:active { transform: translateY(1px); transition-duration: .12s; }
}
