@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/JetBrainsMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

/* Ghostty Editorial Window palette, mapped to SIGNAL's editorial components. */
:root {
  color-scheme: dark;
  --canvas: #0d0e13;
  --bg: #15151b;
  --glow-mint: #254d43;
  --glow-lavender: #383c64;
  --glow-teal: #204b50;
  --frame-shadow: rgb(0 0 0 / .44);
  --frame-rim: #566278;
  --card-glass: rgb(30 34 45 / .86);
  --tag-surface: #28323c;
  --tag-teal: #a4d7d3;
  --surface: #20232d;
  --text: #f5f5fb;
  --muted: #c3c9d2;
  --line: #444d58;
  --figure-line: #61707f;
  --accent: #a7e6ca;
  --title-accent: #c2c9f2;
  --button: #a7e6ca;
  --button-text: #102c23;
  --button-hover: #c0efdb;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

:root[data-theme='light'] {
  color-scheme: light;
  --canvas: #e8edf1;
  --bg: #f7f9f9;
  --glow-mint: #c9e9df;
  --glow-lavender: #d7d9ef;
  --glow-teal: #c7e4e7;
  --frame-shadow: rgb(31 54 60 / .16);
  --frame-rim: #a8b6be;
  --card-glass: rgb(255 255 255 / .8);
  --tag-surface: #e7eeef;
  --tag-teal: #155d63;
  --surface: #e7eeef;
  --text: #18252b;
  --muted: #42545d;
  --line: #c7d1d2;
  --figure-line: #74878e;
  --accent: #126249;
  --title-accent: #424e91;
}

@media (prefers-color-scheme: light) {
  :root[data-theme='system'] {
    color-scheme: light;
    --canvas: #e8edf1;
    --bg: #f7f9f9;
    --glow-mint: #c9e9df;
    --glow-lavender: #d7d9ef;
    --glow-teal: #c7e4e7;
    --frame-shadow: rgb(31 54 60 / .16);
    --frame-rim: #a8b6be;
    --card-glass: rgb(255 255 255 / .8);
    --tag-surface: #e7eeef;
    --tag-teal: #155d63;
    --surface: #e7eeef;
    --text: #18252b;
    --muted: #42545d;
    --line: #c7d1d2;
    --figure-line: #74878e;
    --accent: #126249;
    --title-accent: #424e91;
  }
}

* { box-sizing: border-box; }
html { scroll-padding-top: 1rem; }
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 8% 5%, var(--glow-mint), transparent 38%),
    radial-gradient(ellipse at 95% 20%, var(--glow-lavender), transparent 39%),
    radial-gradient(ellipse at 20% 85%, var(--glow-teal), transparent 37%),
    var(--canvas);
  background-attachment: fixed;
  color: var(--text);
  font: 1rem/1.65 system-ui, sans-serif;
}
[hidden] { display: none !important; }
h1, h2, h3, p, figure, dl, dd { margin: 0; }
h1, h2, h3 { line-height: 1.06; letter-spacing: -.045em; }
h2 { font-size: clamp(1.9rem, 4.3cqi, 3.25rem); }
h3 { font-size: clamp(1.25rem, 2.7cqi, 2rem); }
a { color: var(--accent); text-underline-offset: .2em; }
a:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
.site-frame {
  width: min(1200px, calc(100% - 64px));
  container-type: inline-size;
  margin: clamp(20px, 3vw, 44px) auto;
  border: 1px solid var(--frame-rim);
  border-radius: 28px;
  background: var(--bg);
  background:
    radial-gradient(ellipse at 100% 0%, color-mix(in srgb, var(--glow-lavender) 31%, var(--bg)), transparent 37%),
    radial-gradient(ellipse at 0% 24%, color-mix(in srgb, var(--glow-mint) 25%, var(--bg)), transparent 39%),
    var(--bg);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--glow-lavender) 50%, transparent),
    0 0 42px color-mix(in srgb, var(--glow-lavender) 42%, transparent),
    0 22px 76px var(--frame-shadow);
}
.wrap { width: calc(100% - 96px); margin-inline: auto; }
.skip {
  position: absolute;
  z-index: 2;
  top: .75rem;
  left: .75rem;
  transform: translateY(-180%);
  padding: .55rem .85rem;
  background: var(--surface);
}
.skip:focus { transform: none; }
.mono { font: .76rem/1.5 var(--mono); }
.site-header { border-bottom: 1px solid var(--line); }
.masthead {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: clamp(12px, 3vw, 42px);
  min-height: 72px;
}
.wordmark {
  justify-self: start;
  display: inline-flex;
  gap: .6rem;
  align-items: center;
  min-height: 44px;
  color: var(--text);
  font-size: .95rem;
  font-weight: 690;
  letter-spacing: -.025em;
  text-decoration: none;
}
.wordmark::before {
  content: '';
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent);
  transform: rotate(45deg);
}
.site-nav { display: flex; gap: clamp(8px, 2.5vw, 28px); }
.site-nav a {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  color: var(--text);
  font-size: .9rem;
  text-decoration: none;
}
.site-nav a:hover, .site-nav a[aria-current] { color: var(--accent); text-decoration: underline; }
.theme-control select {
  min-height: 34px;
  max-width: 100%;
  padding: 4px 6px;
  border: 1px solid var(--figure-line);
  border-radius: 8px;
  color: var(--text);
  background: var(--bg);
  font: .78rem system-ui, sans-serif;
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(248px, .55fr);
  align-items: center;
  gap: clamp(32px, 5cqi, 60px);
  padding-block: clamp(44px, 6cqi, 72px);
}
.hero h1 {
  font-size: clamp(2.65rem, 5.6vw, 4.6rem);
  font-size: clamp(2.65rem, 6.1cqi, 4.6rem);
  letter-spacing: -.075em;
  line-height: .98;
  overflow-wrap: anywhere;
}
.hero h1 span { display: block; color: var(--title-accent); }
.hero-name {
  color: var(--accent);
  font-size: clamp(.875rem, 1.3vw, 1.05rem);
  margin-bottom: 20px;
}
.portrait {
  width: min(100%, 320px);
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 7px;
  background: var(--surface);
}
.portrait img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}
.lead {
  max-width: 54ch;
  color: var(--muted);
  font-size: clamp(1.04rem, 1.75cqi, 1.28rem);
  margin-top: 22px;
}
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 24px; }
.button, .secondary {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  min-height: 44px;
  font-size: .94rem;
  font-weight: 650;
}
.button {
  background: var(--button);
  color: var(--button-text);
  border-radius: 8px;
  padding: 8px 16px;
  text-decoration: none;
  transition: background-color 140ms ease;
}
.button:hover { background: var(--button-hover); }
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: clamp(18px, 2.6cqi, 28px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 12px 32px var(--frame-shadow);
  transition: transform 160ms ease;
}
@supports ((backdrop-filter: blur(16px)) or (-webkit-backdrop-filter: blur(16px))) {
  .card {
    background: var(--card-glass);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
  }
}
.card:hover { transform: translateY(-2px); }
.card:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
.card .label {
  color: var(--muted);
  font: .75rem/1.5 var(--mono);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.card h3 { margin: 16px 0 12px; font-size: 1.3rem; }
.card p { color: var(--muted); }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 12px; }
.tag {
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--tag-surface);
  color: var(--muted);
  font: .7rem/1.5 var(--mono);
}
.tag-indigo { color: var(--title-accent); }
.tag-teal { color: var(--tag-teal); }
.card-link {
  align-self: flex-start;
  margin-top: auto;
  padding-top: 8px;
  min-height: 36px;
  font-weight: 650;
}
.card-link::after { content: ''; position: absolute; inset: 0; border-radius: 20px; }
.card-link:focus-visible { outline: none; }
.section-action { display: inline-block; margin-top: 22px; font-weight: 650; }
#work h2 { margin-bottom: 22px; }
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .site-frame { background: var(--bg); }
  .card {
    background: var(--surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
.section { padding-block: clamp(32px, 5vw, 68px); border-top: 1px solid var(--line); }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 8px 20px; flex-wrap: wrap; margin-bottom: 22px; }
.section-heading a { font-weight: 650; }
.chapter {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) minmax(0, .8fr);
  gap: clamp(16px, 3vw, 36px);
  align-items: start;
  padding-block: 24px;
  border-top: 1px solid var(--line);
}
.chapter:last-child { border-bottom: 1px solid var(--line); }
.chapter-number { color: var(--accent); }
.chapter-status { display: block; color: var(--muted); margin-bottom: 7px; }
.chapter-detail p { color: var(--muted); }
.chapter-detail p + p { margin-top: 8px; }
.chapter-detail a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 650; }
.role {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr);
  gap: .5rem 2rem;
  border-top: 1px solid var(--line);
  padding-block: 20px;
}
.role h3 { font-size: 1.2rem; }
.role .date, .role .place { color: var(--muted); font: .8rem/1.55 var(--mono); }
.role .place { margin-block: 6px; }
.role div > p:last-child, .about-copy { color: var(--muted); max-width: 72ch; }
.about-copy p + p { margin-top: 12px; }
.footer {
  border-top: 1px solid var(--line);
  padding-block: 20px;
}
.footer .wrap { display: flex; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.footer a { min-height: 28px; }
.article-head { padding-block: clamp(32px, 6vw, 72px) 32px; border-bottom: 1px solid var(--line); }
.article-head h1 {
  max-width: 20ch;
  margin-top: 16px;
  font-size: clamp(2.35rem, 6.4cqi, 5.1rem);
  overflow-wrap: anywhere;
}
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  margin-bottom: 20px;
}
.article-status { color: var(--accent); }
.article-grid {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) minmax(0, 3.5fr);
  gap: clamp(20px, 5vw, 70px);
  padding-block: 36px 72px;
}
.contents { border-top: 2px solid var(--accent); align-self: start; padding-top: 12px; }
.contents h2 { font: .8rem/1.5 var(--mono); letter-spacing: 0; }
.contents ol { margin: .5rem 0 0; padding-left: 1.3rem; }
.contents a { display: inline-block; min-height: 28px; }
.case-copy { max-width: 70ch; }
.case-copy section + section { margin-top: 32px; }
.case-copy h2 { font-size: clamp(1.42rem, 3cqi, 2.05rem); margin-bottom: 10px; }
.case-copy p { color: var(--muted); }
.case-copy figure { margin: 18px 0; }
.example { margin: 16px 0; padding: 10px clamp(8px, 2vw, 20px); background: var(--surface); border-radius: 12px; }
.example table { border-collapse: collapse; width: 100%; font-size: .94rem; text-align: left; }
.example caption { padding-block: 8px; text-align: left; color: var(--muted); }
.example th, .example td { padding: 8px 4px; border-bottom: 1px solid var(--figure-line); }
.concept { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; background: var(--surface); border-radius: 12px; }
.concept span { font-family: var(--mono); font-size: .85rem; }
.concept b { color: var(--accent); }
.case-return { display: inline-block; margin-top: 30px; min-height: 28px; }

@media (max-width: 1040px) {
  .wrap { width: calc(100% - 64px); }
  .hero { gap: 30px; }
}

@media (max-width: 820px) {
  .hero { grid-template-columns: minmax(0, 1fr); max-width: 38rem; gap: 28px; padding-block: 44px 48px; }
  .hero h1 { font-size: clamp(1.85rem, 8.5cqi, 3.8rem); }
  .hero-name { margin-bottom: 14px; }
  .portrait { justify-self: start; width: min(72%, 270px); }

  .chapter { grid-template-columns: 2.5rem minmax(0, 1fr); gap: 10px 18px; }
  .chapter-detail { grid-column: 2; }
}

@media (max-width: 700px) {
  .site-frame {
    width: calc(100% - 20px);
    margin-block: 10px;
    border-radius: 22px;
  }
  .wrap { width: calc(100% - 32px); }
  .project-grid { grid-template-columns: minmax(0, 1fr); }
  .masthead { grid-template-columns: 1fr auto; min-height: auto; gap: 0 10px; padding-top: 2px; }
  .site-nav { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; border-top: 1px solid var(--line); }
  .site-nav a { font-size: .84rem; }
  .theme-control { grid-column: 2; grid-row: 1; }
  .article-grid, .role { grid-template-columns: minmax(0, 1fr); }
  .article-grid { padding-block: 28px 52px; }
  .contents ol { display: flex; flex-wrap: wrap; gap: 4px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
