/* Design tokens for every faheemnaeem.dev app.
   Derived from apps/web/static/faheem-portfolio.html (paper, ink, teal, green, blue;
   Courier New body text, Georgia headings). Muted text is darkened slightly to meet
   WCAG 2.2 AA (4.5:1). Edit this file, then run `pnpm --filter @faheem/ui sync-css`. */
:root {
    color-scheme: light dark;

    --color-bg: #f2f1e9;
    --color-surface: #f8f7f0;
    --color-surface-alt: #e8eee4;
    --color-text: #252b2b;
    --color-muted: #5f6b6a;
    --color-border: #c9cbc2;
    --color-accent: #164d50;
    --color-accent-strong: #287b78;
    --color-on-accent: #ffffff;
    --color-link: #274c8d;
    --color-success: #83a77d;
    --color-brand: #008080;
    --color-focus: #274c8d;

    --font-mono: 'Courier New', Courier, monospace;
    --font-serif: Georgia, 'Times New Roman', serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-md: 1rem;
    --font-size-lg: 1.25rem;
    --font-size-xl: 1.75rem;
    --font-size-2xl: clamp(2rem, 6vw, 3.5rem);
    --line-height: 1.55;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;

    --radius: 0;
    --content-width: 70rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #121a19;
        --color-surface: #1b2524;
        --color-surface-alt: #22302e;
        --color-text: #e6e9e3;
        --color-muted: #a3aea9;
        --color-border: #34413f;
        --color-accent: #7fc4be;
        --color-accent-strong: #a6d8d3;
        --color-on-accent: #121a19;
        --color-link: #9bb8f0;
        --color-success: #9cc296;
        --color-brand: #1f9c9c;
        --color-focus: #9bb8f0;
    }
}

/* Base styles: reset, focus-visible, skip link, reduced motion, shared header/footer.
   Requires tokens.css. Edit this file, then run `pnpm --filter @faheem/ui sync-css`. */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-mono);
    font-size: var(--font-size-md);
    line-height: var(--line-height);
}

h1,
h2,
h3 {
    margin: 0 0 var(--space-3);
    color: var(--color-accent);
    font-family: var(--font-serif);
    line-height: 1.15;
}

p,
ul,
ol {
    margin: 0 0 var(--space-4);
}

img,
svg,
video {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    color: var(--color-link);
    text-underline-offset: 0.15em;
}

button,
input,
select,
textarea {
    font: inherit;
}

:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 2px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: var(--space-2);
    left: var(--space-2);
    z-index: 1000;
    padding: var(--space-2) var(--space-3);
    background: var(--color-accent);
    color: var(--color-on-accent);
    transform: translateY(-200%);
}

.skip-link:focus,
.skip-link:focus-visible {
    transform: none;
}

.site-header,
.site-footer {
    background: var(--color-surface-alt);
    border-color: var(--color-border);
    border-style: solid;
    border-width: 0;
}

.site-header {
    border-bottom-width: 1px;
}

.site-footer {
    margin-top: auto;
    border-top-width: 1px;
    color: var(--color-muted);
    font-size: var(--font-size-sm);
}

.site-header__inner,
.site-footer__inner,
.site-main {
    width: 100%;
    max-width: var(--content-width);
    margin: 0 auto;
    padding: var(--space-3) var(--space-4);
}

.site-header__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-4);
}

.site-brand {
    color: var(--color-accent);
    font-family: var(--font-serif);
    font-weight: bold;
    text-decoration: none;
}

.site-nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-3);
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-nav a {
    display: inline-block;
    min-height: 24px;
    padding: var(--space-1) 0;
    font-size: var(--font-size-sm);
}

.site-nav a[aria-current='page'] {
    color: var(--color-text);
    font-weight: bold;
    text-decoration-thickness: 3px;
}

.site-main {
    flex: 1;
    padding-block: var(--space-6);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}


.term-page { display: grid; gap: var(--space-4); }
.term-page h1 { font-size: var(--font-size-xl); margin: 0; }
.term-hint { margin: 0; }
.term-hint code {
  padding: 0.1em 0.4em;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
}
.term {
  --term-bg: #f8f7f0; --term-fg: #252b2b; --term-dim: #5f6b6a; --term-cyan: #164d50;
  --term-green: #2f6b2a; --term-yellow: #7a4e00; --term-blue: #274c8d; --term-magenta: #7b2d6b;
  --term-link: #274c8d; --term-bar: #c9cbc2;
  background: var(--term-bg);
  color: var(--term-fg);
  border: 1px solid var(--color-border);
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.15);
}
@media (prefers-color-scheme: dark) {
  .term {
    --term-bg: #101716; --term-fg: #e6e9e3; --term-dim: #a3aea9; --term-cyan: #7fc4be;
    --term-green: #9cc296; --term-yellow: #e3c46b; --term-blue: #9bb8f0; --term-magenta: #d9a0cf;
    --term-link: #9bb8f0; --term-bar: #34413f;
  }
}
.term[data-theme='phosphor'] {
  --term-bg: #050c06; --term-fg: #b6f5bd; --term-dim: #7fbf88; --term-cyan: #6ff7c8;
  --term-green: #57f57a; --term-yellow: #d8f57a; --term-blue: #8fe3ff; --term-magenta: #c3f5a0;
  --term-link: #8fe3ff; --term-bar: #1f3a22;
}
.term[data-theme='amber'] {
  --term-bg: #120c00; --term-fg: #ffcf73; --term-dim: #c99a4a; --term-cyan: #ffe0a3;
  --term-green: #ffd27f; --term-yellow: #fff0c2; --term-blue: #ffc06b; --term-magenta: #ffb37a;
  --term-link: #ffe0a3; --term-bar: #3d2a00;
}
.term__bar {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--term-bar);
  color: var(--term-dim);
  font-size: var(--font-size-sm);
}
.term__dots { display: flex; gap: 6px; }
.term__dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--term-bar); }
.term__output {
  max-height: 70vh;
  overflow: auto;
  padding: var(--space-3);
}
.term__output:focus-visible { outline-offset: -3px; }
.term__pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(0.75rem, 1.9vw, 0.95rem);
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.term__pre + .term__pre { margin-top: var(--space-2); }
.term a { color: var(--term-link); }
.term :focus-visible { outline-color: var(--term-link); }
.t-bold { font-weight: bold; }
.t-dim { color: var(--term-dim); }
.t-cyan, .t-prompt { color: var(--term-cyan); }
.t-green { color: var(--term-green); }
.t-yellow { color: var(--term-yellow); }
.t-blue { color: var(--term-blue); }
.t-magenta { color: var(--term-magenta); }
.term__prompt {
  display: flex; align-items: center; gap: 0.5ch;
  padding: var(--space-2) var(--space-3) var(--space-3);
  font-size: clamp(0.75rem, 2.6vw, 0.95rem);
}
.term__prompt[hidden] { display: none; }
.term__prompt label { color: var(--term-cyan); white-space: nowrap; }
.term__input-wrap { position: relative; flex: 1; display: flex; align-items: center; min-width: 0; }
.term__input {
  flex: 1; min-width: 0; min-height: 24px;
  padding: 0; border: 0; background: transparent;
  color: var(--term-fg); caret-color: var(--term-fg);
  font-family: var(--font-mono); font-size: inherit;
}
.term__input:focus { outline: none; }
.term__input:focus-visible { outline: 2px solid var(--term-link); outline-offset: 2px; }
.term__cursor {
  display: inline-block; width: 0.6em; height: 1.1em;
  background: var(--term-fg);
  animation: term-blink 1s steps(1) infinite;
}
.term__input-wrap:focus-within .term__cursor { display: none; }
.term__input-wrap .term__cursor { position: absolute; left: 0; pointer-events: none; }
.term__input:not(:placeholder-shown) + .term__cursor { display: none; }
@keyframes term-blink { 50% { opacity: 0; } }
.term-links ul { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); padding: 0; margin: 0; list-style: none; }
.term-links a { display: inline-block; min-height: 24px; padding: var(--space-1) 0; }
