/* ajithmk.dev — terminal theme */

:root {
  --bg: #0c0e0c;
  --bg-2: #121512;
  --fg: #d9ded4;
  --fg-strong: #f3f6ef;
  --muted: #8b9386;
  --faint: #262b25;
  --line: #1c201b;
  --rail: #3d453b;
  --green: #8fe388;
  --amber: #f3b64e;
  --red: #ff7b72;
  --blue: #7cc4ff;
  --glow: rgba(143, 227, 136, 0.16);
  --sel: rgba(143, 227, 136, 0.25);

  --font: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --measure: 46rem;
  --gutter: clamp(16px, 4vw, 32px);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f3ec;
    --bg-2: #ece9df;
    --fg: #2a2e28;
    --fg-strong: #10130f;
    --muted: #686f63;
    --faint: #d6d2c4;
    --line: #e2ded2;
    --rail: #bdb8a8;
    --green: #2c7a2f;
    --amber: #9a5a00;
    --red: #b42318;
    --blue: #1f5fa8;
    --glow: transparent;
    --sel: rgba(44, 122, 47, 0.18);
  }
}
:root[data-theme="light"] {
  --bg: #f5f3ec;
  --bg-2: #ece9df;
  --fg: #2a2e28;
  --fg-strong: #10130f;
  --muted: #686f63;
  --faint: #d6d2c4;
  --line: #e2ded2;
  --rail: #bdb8a8;
  --green: #2c7a2f;
  --amber: #9a5a00;
  --red: #b42318;
  --blue: #1f5fa8;
  --glow: transparent;
  --sel: rgba(44, 122, 47, 0.18);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  font-feature-settings: "calt" 1, "liga" 0;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
@media (max-width: 520px) { body { font-size: 14px; } }

::selection { background: var(--sel); color: var(--fg-strong); }

a { color: var(--fg-strong); text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--amber); text-decoration-color: currentColor; }
a:focus-visible, input:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: 2px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--green); color: var(--bg); padding: 4px 10px; z-index: 10; }
.skip:focus { left: 8px; }
.dim { color: var(--muted); }

/* ── top bar ────────────────────────────────────────── */
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.85rem var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  font-size: 0.9em;
}
.bar .host { text-decoration: none; color: var(--fg); white-space: nowrap; }
.bar .host .u { color: var(--green); font-weight: 700; }
.bar .host .at { color: var(--muted); }
.bar .host .h { color: var(--blue); font-weight: 500; }
.bar nav { display: flex; gap: 1.25rem; }
.bar nav a { text-decoration: none; color: var(--muted); }
.bar nav a::before { content: "./"; color: var(--faint); transition: color .15s; }
.bar nav a:hover { color: var(--fg-strong); }
.bar nav a:hover::before { color: var(--green); }
@media (max-width: 520px) {
  .bar .host .dim { display: none; }
  .bar nav { gap: 0.9rem; }
  .bar nav a::before { content: ""; }
}

/* ── terminal body ──────────────────────────────────── */
.term {
  flex: 1;
  width: 100%;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 2.25rem var(--gutter) 3rem;
}
.login { margin: 0 0 2.5rem; font-size: 0.85em; }

.block { margin: 0 0 3.25rem; }
.cmdline { margin: 0 0 0.9rem; color: var(--fg-strong); }
.ps1 { color: var(--green); font-weight: 700; margin-right: 0.15em; }
.cmd { color: var(--fg-strong); }
.out { padding-left: 1.6rem; border-left: 1px solid var(--line); }
@media (max-width: 520px) { .out { padding-left: 0.9rem; } }

.prose p { margin: 0 0 1em; max-width: 62ch; }
.prose p:last-child { margin-bottom: 0; }

/* ── hero ───────────────────────────────────────────── */
.hero { margin-bottom: 4rem; }
.hero h1 {
  margin: 0.1rem 0 0.4rem;
  font-size: clamp(2.1rem, 7vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  font-weight: 800;
  color: var(--fg-strong);
  text-shadow: 0 0 28px var(--glow);
}
.hero .tagline { margin: 0 0 0.75rem; font-size: 1.15em; color: var(--amber); font-weight: 500; }
.hero .lede { margin: 0; max-width: 46ch; color: var(--fg); }

.cursor {
  display: inline-block;
  width: 0.6em; height: 1.15em;
  margin-left: 0.3em;
  vertical-align: text-bottom;
  background: var(--green);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* typing intro (only when JS adds .typing) */
.typing .hero .out { opacity: 0; transform: translateY(4px); }
.typed .hero .out { opacity: 1; transform: none; transition: opacity .45s ease, transform .45s ease; }
.typing [data-type]::after {
  content: ""; display: inline-block; width: 0.55em; height: 1.1em; margin-left: 1px;
  vertical-align: text-bottom; background: var(--fg-strong);
}

/* ── work tree ──────────────────────────────────────── */
.tree-root { margin: 0 0 0.25rem; }
.tree { list-style: none; margin: 0; padding: 0; }
.tree li {
  position: relative;
  padding: 0.15rem 0 1.4rem 2.2rem;
}
.tree li::before { /* ├── */
  content: "├──";
  position: absolute; left: 0; top: 0.15rem;
  color: var(--rail);
}
.tree li:last-child::before { content: "└──"; }
.tree li::after { /* vertical rail │ */
  content: "";
  position: absolute; left: 0.3em; top: 1.9rem; bottom: 0;
  border-left: 1px solid var(--rail);
}
.tree li:last-child::after { display: none; }
.tree li:last-child { padding-bottom: 0.4rem; }

.tree .row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.35rem 0.75rem; }
.tree .name { color: var(--blue); font-weight: 700; }
.tree .tag {
  font-size: 0.78em; line-height: 1; padding: 0.25em 0.55em 0.3em;
  border: 1px solid currentColor; border-radius: 3px;
  color: var(--muted);
}
.tree [data-status="traction"] .tag { color: var(--green); }
.tree [data-status="active"] .tag   { color: var(--amber); }
.tree [data-status="stealth"] .tag  { color: var(--blue); }
.tree .meta { margin: 0.1rem 0 0.25rem; color: var(--muted); font-size: 0.9em; }
.tree .desc { margin: 0; max-width: 60ch; }
.summary { margin: 0.6rem 0 0; font-size: 0.85em; }

/* ── contact ────────────────────────────────────────── */
.links { margin: 1.25rem 0 0; display: grid; gap: 0.35rem; }
.links div { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.75rem; }
.links dt { color: var(--muted); }
.links dt::after { content: " →"; color: var(--faint); }
.links dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 380px) { .links div { grid-template-columns: 5.5rem 1fr; } }

/* ── interactive shell ──────────────────────────────── */
.shell { margin-bottom: 1rem; padding-top: 1.5rem; border-top: 1px dashed var(--faint); }
.history { white-space: pre-wrap; overflow-wrap: anywhere; }
.history .entry { margin: 0 0 0.9rem; }
.history .echo { color: var(--fg-strong); }
.history .res { color: var(--fg); padding-left: 1.6rem; }
.history .err { color: var(--red); }
.history .ok { color: var(--green); }
.history .warn { color: var(--amber); }
.history a { color: var(--blue); }
.history .dir { color: var(--blue); font-weight: 700; }

.prompt { scroll-margin-bottom: 2.5rem; display: flex; align-items: center; gap: 0.5rem; margin: 0; }
.prompt label { display: inline-flex; cursor: text; }
.prompt input {
  flex: 1; min-width: 0;
  font: inherit; color: var(--fg-strong);
  background: transparent; border: 0; padding: 0.2rem 0;
  caret-color: var(--green);
  caret-shape: block;
}
.prompt input::placeholder { color: var(--muted); opacity: 0.7; }
.prompt input:focus { outline: none; }
.prompt input:focus::placeholder { opacity: 0.35; }

/* ── footer ─────────────────────────────────────────── */
.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1.5rem;
  width: calc(100% - 2 * var(--gutter));
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.25rem 0 2rem;
  border-top: 1px solid var(--line);
  font-size: 0.8em;
}

@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
  .typing .hero .out, .typed .hero .out { opacity: 1; transform: none; transition: none; }
}
.tagline[data-err] { color: var(--red); }
