/* ==========================================================================
   /ai — the companion. Page-scoped components.
   ========================================================================== */

/* --------------------------------------------------------------------------
   GATE
   -------------------------------------------------------------------------- */

.gate {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(40px, 10vw, 96px) var(--gutter);
}
.gate__card {
  width: 100%;
  max-width: 480px;
  text-align: center;
}
.gate__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(34px, 7vw, 52px);
  line-height: 1.02;
  text-transform: uppercase;
  color: var(--white);
  margin-top: 6px;
}
.gate__lede {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(17px, 2.4vw, 20px);
  line-height: 1.5;
  color: var(--text-dim);
  margin-top: 20px;
}
.gate__form { margin-top: 36px; }
.gate__field {
  display: block;
  width: 100%;
  height: 62px;
  padding: 0 18px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: clamp(16px, 3.4vw, 19px);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--white);
  background: var(--navy-2);
  border: 1px solid var(--hairline-strong);
  transition: border-color 0.18s var(--ease), background-color 0.18s var(--ease);
}
.gate__field::placeholder {
  color: var(--text-mute);
  letter-spacing: 0.18em;
}
.gate__field:hover { border-color: rgba(139, 155, 180, 0.5); }
.gate__field:focus {
  border-color: var(--gold);
  background: var(--navy-3);
}
.gate__submit { width: 100%; margin-top: 14px; }

.gate__error {
  min-height: 22px;
  margin-top: 14px;
  font-size: var(--fs-small);
  color: #FF8080;              /* 5.6:1 on navy — AA at body size */
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}
.gate__error.is-active { opacity: 1; }

.gate__hint {
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
  font-size: var(--fs-small);
  line-height: 1.6;
  color: var(--text-dim);
}
.gate__hint a { color: var(--gold); text-decoration-color: rgba(212,168,76,0.4); text-underline-offset: 3px; }

@keyframes gate-shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}
.gate__card.is-wrong { animation: gate-shake 0.5s var(--ease); }
@media (prefers-reduced-motion: reduce) {
  .gate__card.is-wrong { animation: none; }
}

/* --------------------------------------------------------------------------
   STATUS BAR
   -------------------------------------------------------------------------- */

.status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--hairline);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.status__dot {
  width: 6px; height: 6px;
  background: var(--gold);
  transform: rotate(45deg);
  flex: none;
}
.status__grant { color: var(--gold); }
.status__sep { color: var(--text-mute); }
.status__lock {
  margin-left: auto;
  background: none;
  font: inherit;
  color: var(--text-mute);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: color 0.18s var(--ease);
}
.status__lock:hover { color: var(--red); }

/* --------------------------------------------------------------------------
   PAGE HEAD
   -------------------------------------------------------------------------- */

.head { padding-block: clamp(48px, 8vw, 84px) clamp(28px, 4vw, 44px); }
.head__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(38px, 7.4vw, 76px);
  line-height: 1;
  text-transform: uppercase;
  color: var(--white);
  text-wrap: balance;
}
.head__title em {
  font-style: normal;
  color: var(--red);
}

/* --------------------------------------------------------------------------
   STEPS — numbered, connected by a hairline spine
   -------------------------------------------------------------------------- */

.steps {
  list-style: none;
  margin-top: 44px;
  counter-reset: step;
}
.steps__item {
  position: relative;
  counter-increment: step;
  padding: 0 0 34px 66px;
}
.steps__item::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: -4px;
  width: 44px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.02em;
  color: var(--gold);
}
/* the spine */
.steps__item::after {
  content: '';
  position: absolute;
  left: 21px;
  top: 30px;
  bottom: 4px;
  width: 1px;
  background: var(--hairline);
}
.steps__item:last-child { padding-bottom: 0; }
.steps__item:last-child::after { display: none; }

.steps__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--white);
}
.steps__body {
  margin-top: 8px;
  color: var(--text-dim);
  max-width: 62ch;
}
.steps__body a { color: var(--gold); text-underline-offset: 3px; }

/* --------------------------------------------------------------------------
   FILE PANEL — the master instruction set. The centrepiece of the site.
   -------------------------------------------------------------------------- */

.file {
  margin-top: 36px;
  background: var(--navy-2);
  border: 1px solid var(--hairline-strong);
}
.file__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 14px 18px;
  background: var(--navy-3);
  border-bottom: 1px solid var(--gold);
}
.file__name {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}
.file__meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}
.file__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-left: auto;
}

.btn--copy {
  min-height: 44px;                     /* touch target floor */
  padding: 0 20px;
  font-size: 13px;
  background: var(--gold);
  color: var(--navy);
  white-space: nowrap;
}
.btn--copy:hover { background: #E0B75E; }
.btn--copy.is-copied { background: #7FBF7F; color: #0A1A0A; }

.btn--file {
  min-height: 44px;                     /* touch target floor */
  padding: 0 16px;
  font-size: 13px;
  border-color: var(--hairline-strong);
  color: var(--text);
  white-space: nowrap;
}
.btn--file:hover { border-color: var(--gold); color: var(--gold); }
.btn--file.is-copied { border-color: #7FBF7F; color: #7FBF7F; }

.file__scroll {
  position: relative;
}
/* top / bottom fade so the scroll region reads as a window into a longer file */
.file__scroll::before,
.file__scroll::after {
  content: '';
  position: absolute;
  left: 0; right: 14px;
  height: 28px;
  pointer-events: none;
  z-index: 2;
}
.file__scroll::before { top: 0;    background: linear-gradient(var(--navy-2), rgba(13,31,60,0)); }
.file__scroll::after  { bottom: 0; background: linear-gradient(rgba(13,31,60,0), var(--navy-2)); }

.file__body {
  margin: 0;
  max-height: clamp(340px, 52vh, 560px);
  overflow: auto;
  padding: 26px 22px;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  tab-size: 2;
  scrollbar-width: thin;
  scrollbar-color: var(--hairline-strong) transparent;
}
.file__body::-webkit-scrollbar { width: 10px; }
.file__body::-webkit-scrollbar-track { background: transparent; }
.file__body::-webkit-scrollbar-thumb {
  background: var(--hairline-strong);
  border: 3px solid var(--navy-2);
  border-radius: 6px;
}
.file__body::-webkit-scrollbar-thumb:hover { background: var(--text-mute); }

/* The seven fields the reader must personalise. Wrapping these in a span
   does not change textContent, so the copied text stays byte-exact. */
.tok {
  color: var(--gold);
  background: rgba(212, 168, 76, 0.1);
  box-shadow: inset 0 -1px 0 rgba(212, 168, 76, 0.45);
  padding: 1px 2px;
}

.file__foot {
  padding: 14px 18px;
  border-top: 1px solid var(--hairline);
  font-size: var(--fs-small);
  color: var(--text-dim);
}
.file__foot .tok { font-family: var(--font-mono); font-size: 12.5px; }

/* --------------------------------------------------------------------------
   MANUAL FALLBACK — only ever shown if both copy paths fail
   -------------------------------------------------------------------------- */

.manual {
  margin-top: 16px;
  padding: 16px 18px;
  background: rgba(212, 38, 38, 0.08);
  border: 1px solid rgba(212, 38, 38, 0.5);
  border-left-width: 3px;
  font-size: var(--fs-small);
  line-height: 1.65;
  color: var(--text);
}
.manual__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #FF8080;
  margin-bottom: 6px;
}

/* --------------------------------------------------------------------------
   PROMPT TEMPLATES
   -------------------------------------------------------------------------- */

.tpls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  margin-top: 40px;
  list-style: none;
}
.tpl {
  display: flex;
  flex-direction: column;
  background: var(--navy-2);
  border: 1px solid var(--hairline);
  transition: border-color 0.18s var(--ease);
}
.tpl:hover { border-color: var(--hairline-strong); }
.tpl__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--hairline);
}
.tpl__n {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--gold);
  flex: none;
}
.tpl__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
}
.tpl__copy {
  margin-left: auto;
  flex: none;
  min-height: 44px;                     /* touch target floor */
  padding: 0 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--hairline-strong);
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
  white-space: nowrap;
}
.tpl__copy:hover { color: var(--gold); border-color: var(--gold); }
.tpl__copy.is-copied { color: #7FBF7F; border-color: #7FBF7F; }
.tpl__body {
  margin: 0;
  flex: 1;
  padding: 18px 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* --------------------------------------------------------------------------
   RESOURCE CARDS
   -------------------------------------------------------------------------- */

.res {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px 28px;
  margin-top: 36px;
  padding: 26px;
  background: var(--navy-2);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--gold);
}
.res__text { flex: 1 1 320px; }
.res__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--white);
}
.res__body { margin-top: 6px; color: var(--text-dim); font-size: var(--fs-small); }
.res__cta { flex: none; }
.res__pending {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-mute);
  border: 1px dashed var(--hairline-strong);
  padding: 12px 18px;
}

/* --------------------------------------------------------------------------
   SUPPORT
   -------------------------------------------------------------------------- */

.faq { margin-top: 36px; border-top: 1px solid var(--hairline); }
.faq__item { border-bottom: 1px solid var(--hairline); }
.faq__q {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 20px 0;
  text-align: left;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  transition: color 0.18s var(--ease);
}
.faq__q:hover { color: var(--gold); }
.faq__mark {
  margin-left: auto;
  flex: none;
  width: 11px; height: 11px;
  border-right: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
  transform: rotate(45deg) translate(-3px, -3px);
  transition: transform 0.24s var(--ease);
}
.faq__item[open] .faq__mark { transform: rotate(225deg) translate(-3px, -3px); }
.faq__a {
  padding: 0 0 22px;
  color: var(--text-dim);
  max-width: 66ch;
}
.faq__a a { color: var(--gold); text-underline-offset: 3px; }
.faq__q::-webkit-details-marker { display: none; }
.faq__q::marker { content: ''; }

/* --------------------------------------------------------------------------
   FOOTER
   -------------------------------------------------------------------------- */

.foot {
  margin-top: clamp(64px, 10vw, 120px);
  padding-block: 40px;
  border-top: 1px solid var(--hairline);
  font-size: var(--fs-small);
  color: var(--text-mute);
}
.foot__row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  align-items: center;
  justify-content: space-between;
}
.foot a { color: var(--text-dim); text-underline-offset: 3px; }
.foot a:hover { color: var(--gold); }

/* --------------------------------------------------------------------------
   COMPANION VISIBILITY
   Gated content is inert until unlocked. `hidden` plus display keeps it out
   of the accessibility tree and out of tab order.
   -------------------------------------------------------------------------- */

[hidden] { display: none !important; }

@media (max-width: 640px) {
  .file__bar { flex-direction: column; align-items: stretch; }
  .file__actions { margin-left: 0; }
  .btn--copy, .btn--file { flex: 1 1 auto; }
  .file__meta { white-space: normal; }
}
