/* ---------------------------------------------------------------------------
   awohl.com — design system
   Hairline-ruled, monospace-labeled, ink-on-paper. No external assets.
   --------------------------------------------------------------------------- */

/* --- tokens -------------------------------------------------------------- */

:root {
  --bg:          #fbfbfa;
  --bg-2:        #f2f2ef;
  --surface:     #ffffff;
  --line:        #e2e2dc;
  --line-2:      #c7c7bf;
  --ink:         #17171a;
  --ink-2:       #4a4a52;
  --ink-3:       #63636c;
  --accent:      #0b5cad;
  --accent-2:    #8a3d00;
  --accent-wash: #eef3fa;
  --amber-wash:  #fbf4e9;
  --selection:   #cfe0f4;
  --on-accent:   #ffffff;
  --danger:      #b3312b;

  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;

  --wrap:  74rem;
  --prose: 42rem;

  --r:    6px;
  --r-lg: 10px;

  --step:  1.6rem;
  --gap:   1.25rem;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #0e0f12;
    --bg-2:        #16181c;
    --surface:     #131519;
    --line:        #262a31;
    --line-2:      #3a414c;
    --ink:         #e9eaec;
    --ink-2:       #a8aeb8;
    --ink-3:       #838a96;
    --accent:      #6ba4ff;
    --accent-2:    #e0a24a;
    --accent-wash: #16202f;
    --amber-wash:  #241d12;
    --selection:   #1e3a5f;
    --on-accent:   #08101d;
    --danger:      #ff6b5e;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg:          #0e0f12;
  --bg-2:        #16181c;
  --surface:     #131519;
  --line:        #262a31;
  --line-2:      #3a414c;
  --ink:         #e9eaec;
  --ink-2:       #a8aeb8;
  --ink-3:       #838a96;
  --accent:      #6ba4ff;
  --accent-2:    #e0a24a;
  --accent-wash: #16202f;
  --amber-wash:  #241d12;
  --selection:   #1e3a5f;
  --on-accent:   #08101d;
  --danger:      #ff6b5e;
  color-scheme: dark;
}

/* --- reset --------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* The header is sticky, so anchored targets must clear it. */
  scroll-padding-top: 5rem;
}

@media (max-width: 46rem) {
  html { scroll-padding-top: 8.5rem; }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--selection); }

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.018em;
  font-weight: 640;
  text-wrap: balance;
}

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

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

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

/* --- layout -------------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

@media (max-width: 40rem) {
  .wrap { padding-inline: 1.1rem; }
}

.stack > * + * { margin-top: var(--gap); }

main { display: block; }

:target, [id] { scroll-margin-top: 0.5rem; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--on-accent);
  padding: 0.6rem 1rem;
  z-index: 100;
  border-radius: 0 0 var(--r) 0;
}
.skip:focus { left: 0; }

/* --- header -------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 3.75rem;
}

.brand {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  flex: 0 0 auto;
}
.brand::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.55rem;
  background: var(--accent);
  border-radius: 1px;
  vertical-align: 0.02em;
}
.brand:hover { color: var(--accent); }

.nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-wrap: wrap;
}

.nav a {
  font-family: var(--font-mono);
  font-size: 0.795rem;
  letter-spacing: 0.01em;
  color: var(--ink-2);
  text-decoration: none;
  padding: 0.4rem 0.6rem;
  border-radius: var(--r);
  white-space: nowrap;
}
.nav a:hover { color: var(--ink); background: var(--bg-2); }
.nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--bg-2);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.theme-toggle {
  font-family: var(--font-mono);
  font-size: 0.795rem;
  line-height: 1;
  color: var(--ink-2);
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 0.42rem 0.5rem;
  cursor: pointer;
  margin-left: 0.35rem;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--line-2); }

@media (max-width: 46rem) {
  /* Six nav items cannot fit 320px at a legible size. Rather than wrap onto a
     third row and make a sticky header eat a fifth of the viewport, keep the
     nav on one row and let it scroll horizontally within itself. */
  .site-header .wrap {
    flex-wrap: wrap;
    padding-block: 0.55rem;
    gap: 0.5rem;
    min-height: 0;
  }
  .nav {
    order: 3;
    margin-left: 0;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    gap: 0;
    /* Bleed to the viewport edges so the row reads as scrollable. */
    margin-inline: -1.1rem;
    padding-inline: 1.1rem;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding-inline: 0.55rem; }
  .theme-toggle { margin-left: auto; order: 2; }
}

/* --- shared type --------------------------------------------------------- */

.kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0;
}

.lede {
  font-size: 1.14rem;
  line-height: 1.62;
  color: var(--ink-2);
  max-width: 46rem;
  text-wrap: pretty;
}

.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.mono  { font-family: var(--font-mono); }

/* --- hero ---------------------------------------------------------------- */

.hero {
  padding-block: clamp(3rem, 9vw, 6.5rem) clamp(2.5rem, 6vw, 4rem);
  border-bottom: 1px solid var(--line);
}

.hero h1 {
  font-size: clamp(2.1rem, 6.2vw, 3.9rem);
  letter-spacing: -0.03em;
  margin-block: 0.9rem 1.4rem;
  max-width: 20ch;
}

.hero .lede { font-size: clamp(1.05rem, 2.1vw, 1.25rem); }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 2.1rem;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0 2.5rem;
  margin-top: 2.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-3);
}
.facts b {
  display: block;
  font-size: 1.5rem;
  font-weight: 640;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.3;
}

/* --- buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1;
  padding: 0.78rem 1.15rem;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  color: var(--ink);
  background: var(--surface);
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.btn:hover { border-color: var(--ink-3); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 85%, var(--ink));
  border-color: color-mix(in srgb, var(--accent) 85%, var(--ink));
  color: var(--on-accent);
}

/* --- sections ------------------------------------------------------------ */

.section {
  padding-block: clamp(2.75rem, 6vw, 4.5rem);
  border-bottom: 1px solid var(--line);
}
.section:last-of-type { border-bottom: 0; }

.section-head { margin-bottom: 2rem; max-width: 48rem; }
.section-head h2 {
  font-size: clamp(1.5rem, 3.4vw, 2.05rem);
  margin-block: 0.65rem 0.75rem;
}
.section-head p { color: var(--ink-2); text-wrap: pretty; }

/* --- grids & cards ------------------------------------------------------- */

.grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(min(21rem, 100%), 1fr));
}
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(24rem, 100%), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.35rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.card h3 { font-size: 1.02rem; letter-spacing: -0.01em; }
.card p  { color: var(--ink-2); font-size: 0.925rem; }

a.card {
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, transform .15s;
}
a.card:hover { border-color: var(--line-2); transform: translateY(-2px); }
a.card h3 { color: var(--accent); }

.card-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--ink-3);
}

.card-more {
  margin-top: auto;
  padding-top: 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
}
.card-more::after { content: " \2192"; }

/* --- project entries ----------------------------------------------------- */

.projects {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.proj {
  display: grid;
  grid-template-columns: minmax(11rem, 15rem) 1fr;
  gap: 0.4rem 2rem;
  padding-block: 1.15rem;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}

.proj-name {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  overflow-wrap: anywhere;
}
.proj-name a { text-decoration: none; }
.proj-name a:hover { text-decoration: underline; }

.proj-body p { color: var(--ink-2); font-size: 0.94rem; text-wrap: pretty; }
.proj-body p + p { margin-top: 0.4rem; }

.proj-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  color: var(--ink-2);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.12rem 0.42rem;
  white-space: nowrap;
}

.stars {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-2);
  white-space: nowrap;
}

.wip {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  color: var(--accent-2);
  background: var(--amber-wash);
  border: 1px solid color-mix(in srgb, var(--accent-2) 30%, transparent);
  border-radius: 3px;
  padding: 0.12rem 0.42rem;
  white-space: nowrap;
}

.demo-link {
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

@media (max-width: 44rem) {
  .proj { grid-template-columns: 1fr; gap: 0.35rem; }
}

/* --- group heading inside a portfolio page ------------------------------- */

.group { margin-top: 3rem; }
.group:first-of-type { margin-top: 0; }
.group > h2 {
  font-size: 1.3rem;
  margin-bottom: 0.45rem;
}
.group > p.group-note {
  color: var(--ink-2);
  font-size: 0.95rem;
  margin-bottom: 1.1rem;
  max-width: 46rem;
  text-wrap: pretty;
}

/* --- callout ------------------------------------------------------------- */

.callout {
  background: var(--accent-wash);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: var(--r-lg);
  padding: 1.4rem 1.5rem;
}
.callout h3 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.callout p { color: var(--ink-2); }

/* --- blog ---------------------------------------------------------------- */

.post-list { border-top: 1px solid var(--line); }

.post-item {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0.3rem 2rem;
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.post-item h2 { font-size: 1.22rem; margin-bottom: 0.4rem; }
.post-item h2 a { text-decoration: none; }
.post-item h2 a:hover { text-decoration: underline; }
.post-item p { color: var(--ink-2); font-size: 0.95rem; text-wrap: pretty; }

.post-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-3);
  padding-top: 0.28rem;
}

@media (max-width: 44rem) {
  .post-item { grid-template-columns: 1fr; }
  .post-date { padding-top: 0; }
}

.post-header { margin-bottom: 2.25rem; }
.post-header h1 {
  font-size: clamp(1.8rem, 4.6vw, 2.7rem);
  margin-block: 0.7rem 0.9rem;
  max-width: 24ch;
}

.post-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1rem; }

/* --- prose (rendered markdown) ------------------------------------------- */

.prose {
  max-width: var(--prose);
  font-size: 1.035rem;
  /* Bare URLs used as link text are single unbreakable tokens and will push
     past a narrow viewport unless they are allowed to break. */
  overflow-wrap: break-word;
}
.prose > * + * { margin-top: 1.15rem; }

.prose h2 {
  font-size: 1.42rem;
  margin-top: 2.5rem;
  padding-top: 0.35rem;
}
.prose h3 { font-size: 1.14rem; margin-top: 1.9rem; }
.prose h4 { font-size: 1rem; margin-top: 1.6rem; color: var(--ink-2); }

.prose ul, .prose ol { padding-left: 1.35rem; }
.prose li + li { margin-top: 0.4rem; }
.prose li > ul, .prose li > ol { margin-top: 0.4rem; }

.prose blockquote {
  margin: 0;
  padding-left: 1.1rem;
  border-left: 2px solid var(--line-2);
  color: var(--ink-2);
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin-block: 2.25rem;
}

.prose img { border-radius: var(--r); border: 1px solid var(--line); }

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}
.prose th, .prose td {
  text-align: left;
  padding: 0.5rem 0.8rem 0.5rem 0;
  border-bottom: 1px solid var(--line);
}
.prose th { font-weight: 600; }

.table-scroll { overflow-x: auto; }

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.885em;
}

:not(pre) > code {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.08em 0.34em;
  overflow-wrap: anywhere;
}

pre {
  margin: 0;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  line-height: 1.55;
  font-size: 0.86rem;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; }

/* --- footer -------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  margin-top: 0;
  padding-block: 2.5rem 3rem;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2.5rem;
  align-items: baseline;
  justify-content: space-between;
}
.site-footer p,
.site-footer a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-3);
}
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 1.25rem; }

/* --- forms (contact) ----------------------------------------------------- */

.form-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.75rem;
  max-width: 38rem;
}
.form-group + .form-group { margin-top: 1.25rem; }

.form-box label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--ink-2);
  margin-bottom: 0.4rem;
}
.required::after { content: " *"; color: var(--accent-2); }

.form-box input[type="text"],
.form-box input[type="email"],
.form-box textarea {
  width: 100%;
  font: inherit;
  font-size: 0.97rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  padding: 0.6rem 0.7rem;
}
.form-box textarea { min-height: 9rem; resize: vertical; }
/* Declared after the .error rule so an errored field still shows focus:
   equal specificity means source order decides. */
.form-box input:focus, .form-box textarea:focus,
.form-box input.error:focus, .form-box textarea.error:focus {
  outline: 2px solid transparent;   /* keeps a ring in forced-colors mode */
  outline-offset: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
.form-box input.error, .form-box textarea.error { border-color: var(--danger); }

.error-msg {
  display: none;
  color: var(--danger);
  font-size: 0.84rem;
  margin-top: 0.35rem;
}
.error-msg.visible { display: block; }
.hint { color: var(--ink-3); font-size: 0.84rem; margin-top: 0.35rem; }

.char-count {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ink-3);
  text-align: right;
  margin-top: 0.35rem;
}
.char-count.warning { color: var(--accent-2); }

/* The hCaptcha iframe is a fixed ~303px wide and cannot be reflowed. Let the
   wrapper scroll instead of the whole page on narrow screens. */
.captcha-wrapper {
  margin-top: 1.4rem;
  overflow-x: auto;
}

.hidden { display: none !important; }

.form-box button[type="submit"] {
  margin-top: 1.5rem;
  width: 100%;
  justify-content: center;
  font-size: 0.88rem;
  padding-block: 0.85rem;
}
.form-box button[type="submit"]:disabled { opacity: 0.55; cursor: default; }

.notice {
  border-radius: var(--r);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  border: 1px solid;
}
.notice-ok  { background: var(--accent-wash); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.notice-bad { background: var(--amber-wash);  border-color: color-mix(in srgb, var(--accent-2) 30%, transparent); }

/* --- AI-built mark ------------------------------------------------------- */

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

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

.ai-mark {
  display: inline-flex;
  align-items: center;
  color: var(--ink-3);
  text-decoration: none;
  flex: 0 0 auto;
  transition: color .15s;
}
.ai-mark svg {
  width: 3.9rem;
  height: auto;
  display: block;
}
.ai-mark:hover { color: var(--accent); }

/* Larger, standalone use — the explainer block on the landing page. */
.ai-mark-lg svg { width: 8.5rem; }

.ai-callout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem 2.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.6rem 1.75rem;
}
.ai-callout .ai-mark-lg { color: var(--ink); }
.ai-callout p { color: var(--ink-2); flex: 1 1 22rem; min-width: 0; }

/* --- misc ---------------------------------------------------------------- */

.backlink {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-decoration: none;
  display: inline-block;
}
.backlink::before { content: "\2190  "; }
.backlink:hover { text-decoration: underline; }

.page-head {
  padding-block: clamp(2.5rem, 7vw, 4.25rem) clamp(1.75rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--line);
}
.page-head h1 {
  font-size: clamp(1.9rem, 5vw, 3rem);
  margin-block: 0.8rem 1rem;
  max-width: 20ch;
}
