/* ==========================================================================
   Singleton — terminal landing page styles
   Single stylesheet, no build step. Design tokens first, then components.
   ========================================================================== */

:root {
  /* Solid palette (hex ramp) */
  --green:      #3dff7a;  /* primary accent: prompt, links, title */
  --green-soft: #7cffb0;  /* user name, highlights, "ok" / success state */
  --lime:       #b8ff5c;  /* commands, keys */
  --text:       #8fe6a8;  /* body text */
  --text-out:   #a6f0bd;  /* command output, input text */
  --motd:       #6fbf8a;  /* motd italic, kbd hint */
  --dim:        #3f7a52;  /* login line, hints, disabled */
  --dim-2:      #2c5a3c;  /* separators */
  --err:        #ff9d8a;  /* error text */
  --bg:         #020604;  /* base background */
  --panel:      #0a1a0f;  /* titlebar, form card, autofill fill */
  --window-bg:  rgba(4, 14, 8, 0.94);

  /* Glow/border colors are all derived from these channel triplets, so one
     hue drives every alpha. Kept exactly in sync with the hex tokens above
     (e.g. --accent-rgb == --green) to avoid the near-duplicate-green drift. */
  --accent-rgb:     61, 255, 122;  /* == --green */
  --green-soft-rgb: 124, 255, 176; /* == --green-soft */
  --lime-rgb:       184, 255, 92;  /* == --lime */
  --panel-rgb:      10, 26, 15;    /* == --panel */

  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

html, body {
  margin: 0;
  padding: 0;
  /* Solid base color guarantees the screen is never white — including any
     area the mobile address bar exposes as it collapses. */
  background: var(--bg);
  /* Prevent horizontal scroll with `clip`, NOT `hidden`: `hidden` would
     force overflow-y to compute to `auto`, turning this into a scroll
     container that clips the window's glow at the document's top/bottom
     edges (a hard green→black line). `clip` leaves overflow-y visible so
     the glow renders past the edges and fades out naturally. */
  overflow-x: clip;
}

/* The ambient gradient lives on a fixed, full-viewport layer behind all
   content. We use a position:fixed pseudo-element rather than
   `background-attachment: fixed`, which iOS Safari renders incorrectly —
   it clips the gradient into a box near the top of the screen. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(circle at 50% 0%, #04140a 0%, #030a06 55%, var(--bg) 100%);
}

a { color: inherit; text-decoration: none; }
a:hover { color: inherit; }

@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  box-sizing: border-box;
  font-family: var(--mono);
}

.window {
  width: 100%;
  max-width: 720px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 8px 0 rgba(var(--accent-rgb), 0.35);
  background: var(--window-bg);
  border: 1px solid rgba(var(--accent-rgb), 0.28);
}

/* --- Title bar ----------------------------------------------------------- */

.titlebar {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.28);
  position: relative;
}
.lights { display: flex; gap: 8px; align-items: center; }
.light { width: 12px; height: 12px; border-radius: 50%; }
/* macOS traffic-light colors — intentionally outside the green theme. */
.light.red { background: #ff5f57; }
.light.yellow { background: #febc2e; }
.light.green { background: #28c840; }
.title {
  position: absolute; left: 0; right: 0;
  text-align: center;
  font-size: 13px;
  color: var(--green);
  font-weight: 500;
  pointer-events: none;
  text-shadow: 0 0 8px rgba(var(--accent-rgb), 0.7);
  letter-spacing: 0.5px;
}

/* --- Terminal body ------------------------------------------------------- */

/* position: relative so the absolutely-positioned measurement probe is
   contained here and clipped by .window's overflow:hidden, instead of
   escaping to the viewport and creating horizontal scroll. */
.body { position: relative; padding: 32px 34px 40px; font-size: 15px; line-height: 1.85; color: var(--text); }
.login { color: var(--dim); }
.motd {
  margin-top: 18px;
  font-style: italic;
  color: var(--motd);
  line-height: 1.65;
  text-shadow: 0 0 8px rgba(var(--green-soft-rgb), 0.25);
}
.prompt { margin-top: 26px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.prompt.first { margin-top: 22px; }
.tilde { color: var(--green); text-shadow: 0 0 8px rgba(var(--accent-rgb), 0.7); }
.user { color: var(--green-soft); text-shadow: 0 0 8px rgba(var(--green-soft-rgb), 0.5); }
.cmd { color: var(--lime); text-shadow: 0 0 8px rgba(var(--lime-rgb), 0.5); }
.out { margin-top: 8px; color: var(--text-out); }

/* --- Link rows ----------------------------------------------------------- */

.links { margin-top: 10px; display: grid; gap: 8px; }
.link { display: flex; gap: 14px; align-items: baseline; width: fit-content; transition: opacity 0.12s ease; }
.link:hover { opacity: 0.75; }
.link .key { color: var(--lime); min-width: 92px; }
.link .val { color: var(--green); border-bottom: 1px solid rgba(var(--accent-rgb), 0.45); text-shadow: 0 0 6px rgba(var(--accent-rgb), 0.4); }
/* Links carry a full URL and a short form; the short one only shows on
   narrow screens where the full URL would overflow the width. */
.val .v-short { display: none; }

.cursor {
  width: 9px; height: 18px;
  background: var(--green);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.85);
  display: inline-block;
  animation: blink 1.1s step-end infinite;
}

.hint { color: var(--dim); margin-top: 22px; }

/* Runnable command words. Real <button>s (keyboard-accessible) reset to look
   like inline text so they blend into the terminal output. */
.run-cmd {
  /* No `color` here: every .run-cmd also carries .cmd or .key, which supply
     the color. Setting color:inherit would override those (it's later in the
     cascade) and dim the hint-line commands. */
  background: none;
  border: 0;
  font: inherit;
  padding: 0;
  text-align: left;
  vertical-align: baseline;
  cursor: pointer;
  transition: opacity 0.12s ease;
}
.run-cmd:hover { opacity: 0.7; text-decoration: underline; text-underline-offset: 3px; }

/* --- Prompt input -------------------------------------------------------- */

.input-line { cursor: text; }
.cmd-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-out);
  caret-color: var(--green);
  font: inherit;
  font-size: 15px;
  padding: 0;
  text-shadow: 0 0 6px rgba(var(--green-soft-rgb), 0.35);
}

.cmdlist { margin-top: 8px; display: grid; gap: 6px; }
.cmdlist .key { color: var(--lime); min-width: 92px; display: inline-block; text-shadow: 0 0 6px rgba(var(--lime-rgb), 0.4); }
.err { color: var(--err); }

/* Form status line: color owned by CSS via state classes (.ok / .err). */
.form-status.ok  { color: var(--green-soft); }
.form-status.err { color: var(--err); }

/* --- Contact form -------------------------------------------------------- */

.cc-form {
  margin-top: 10px;
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  border-radius: 10px;
  background: rgba(var(--panel-rgb), 0.5);
  box-shadow: inset 0 0 26px -14px rgba(var(--accent-rgb), 0.4);
}
/* Honeypot spam trap — off-screen, unreachable by keyboard/AT. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.field { display: flex; gap: 14px; align-items: baseline; }
.field.msg { align-items: flex-start; }
.fkey { color: var(--lime); min-width: 64px; text-shadow: 0 0 8px rgba(var(--lime-rgb), 0.5); }
.finput {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.35);
  color: var(--green);
  caret-color: var(--green);
  font: inherit;
  font-size: 15px;
  line-height: 1.6;
  padding: 2px 0;
  text-shadow: 0 0 6px rgba(var(--accent-rgb), 0.4);
  outline: none;
  resize: vertical;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.finput::placeholder { color: var(--dim); }
.finput:focus {
  border-bottom-color: var(--green);
  box-shadow: 0 2px 8px -4px rgba(var(--accent-rgb), 0.7);
}
/* Autofill works as normal; we only restyle its highlight. The bright
   browser default is replaced with a subtle dark-green fill (the form
   card's own color) via an inset box-shadow, and the text stays green. */
.finput:-webkit-autofill,
.finput:-webkit-autofill:hover,
.finput:-webkit-autofill:focus,
.finput:-webkit-autofill:active,
.finput:autofill {
  -webkit-text-fill-color: var(--green);
  -webkit-box-shadow: 0 0 0 1000px var(--panel) inset;
  box-shadow: 0 0 0 1000px var(--panel) inset;
  caret-color: var(--green);
}
.cc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid rgba(var(--accent-rgb), 0.16);
  font-size: 13px;
}
.cc-status .req { color: var(--dim); transition: color 0.12s ease, text-shadow 0.12s ease; }
.cc-status .req.ok { color: var(--green-soft); text-shadow: 0 0 8px rgba(var(--green-soft-rgb), 0.55); }
.cc-status .sep { color: var(--dim-2); margin: 0 3px; }

.cc-send {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  font: inherit;
  font-size: 13px;
  color: var(--dim);
  cursor: default;
  padding: 0;
  transition: color 0.12s ease, opacity 0.12s ease;
}
.cc-send .kbd {
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  border-radius: 5px;
  padding: 2px 7px;
  color: var(--motd);
  line-height: 1;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
  transition: border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}
.cc-send:disabled { opacity: 0.55; }
.cc-send:not(:disabled) { color: var(--lime); cursor: pointer; text-shadow: 0 0 8px rgba(var(--lime-rgb), 0.5); }
.cc-send:not(:disabled) .kbd {
  border-color: rgba(var(--lime-rgb), 0.6);
  color: var(--lime);
  box-shadow: 0 0 10px -2px rgba(var(--lime-rgb), 0.6), 0 1px 0 rgba(0, 0, 0, 0.4);
}
.cc-send:not(:disabled):hover { opacity: 0.8; }

/* --- Mobile -------------------------------------------------------------- */

@media (max-width: 640px) {
  /* Keep the terminal centered with a slim gradient frame instead of the
     40px desktop margin. The gradient on <body> still fills the screen
     behind it, so there's no white border. */
  .page { padding: 16px; }
  .body { padding: 24px 20px 32px; }

  /* Inputs must be >=16px, otherwise iOS auto-zooms the whole page the
     moment the keyboard opens on focus, which shifts and breaks the layout.
     Match the body text so the monospace grid stays aligned. */
  .body,
  .cmd-input,
  .finput { font-size: 16px; }

  /* Swap full URLs for their short form so links fit the screen width. */
  .val .v-long { display: none; }
  .val .v-short { display: inline; }
}
