:root {
  color-scheme: dark;
  --page: #0c121c;
  --ink: #e9ebee;
  --muted: #a7b3c5;
  --accent: #c4deff;
  --rule: #a9c1e033;
  --gutter: clamp(20px, 5vw, 80px);
  color: var(--ink);
  background: var(--page);
  font: 16px/1.5 "Avenir Next", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; }
[hidden] { display: none !important; }
a, button, input { color: inherit; }
button, input { font: inherit; }
a:focus-visible, button:focus-visible, summary:focus-visible, .transcript:focus-visible {
  outline: 2px solid #a7cfff;
  outline-offset: 4px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.masthead {
  min-height: 75px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px var(--gutter);
  border-bottom: 1px solid var(--rule);
}
.masthead > a { color: var(--ink); font-size: .99rem; font-weight: 650; letter-spacing: -.025em; }
.portfolio-return { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px clamp(10px, 3vw, 29px); }
.project-link { color: var(--muted); font-size: .88rem; text-decoration: none; }
.project-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: .22em; }

.experience {
  display: grid;
  grid-template-columns: minmax(0, 1.23fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(32px, 6vw, 105px);
  width: min(100%, 1560px);
  min-height: calc(100svh - 75px);
  margin-inline: auto;
  padding: clamp(36px, 6vh, 68px) var(--gutter);
}

.portrait {
  position: relative;
  isolation: isolate;
  margin: 0;
  height: clamp(470px, 73svh, 790px);
  overflow: hidden;
  border: 1px solid #b0cdf02b;
  border-radius: 3px;
  background:
    radial-gradient(ellipse at 42% 42%, #172b454f, transparent 62%),
    radial-gradient(ellipse at 85% 72%, #12223870, transparent 58%),
    #090f17;
  transition: border-color .38s ease;
}
.portrait::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(90deg, #9fbbed0a 1px, transparent 1px), linear-gradient(#9fbbed0a 1px, transparent 1px);
  background-size: 41px 41px;
  mask-image: radial-gradient(ellipse at center, #000 4%, transparent 76%);
  pointer-events: none;
}
.portrait[data-state="thinking"] { border-color: #9dc9ff85; }
.portrait canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }

.conversation { width: 100%; max-width: 500px; }
.introduction h1 {
  margin: 0;
  font: 400 clamp(3.25rem, 6.35vw, 7rem)/.97 "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  letter-spacing: -.073em;
}
.introduction p {
  max-width: 29ch;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(1.02rem, 1.5vw, 1.25rem);
  line-height: 1.45;
}
.question-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 6px;
  margin-top: clamp(27px, 4.7vh, 48px);
  padding: 6px;
  border: 1px solid #91b9ed57;
  border-radius: 5px;
  background: #121b2a;
  transition: border-color .2s ease;
}
.question-form:focus-within { border-color: #b6d5ff; }
.question-form input {
  min-width: 0;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  outline: 0;
  background: transparent;
}
.question-form input::placeholder { color: var(--muted); opacity: 1; }
.ask-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 74px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: var(--accent);
  color: #102137;
  font-size: .89rem;
  font-weight: 700;
  cursor: pointer;
}
.ask-button span { font-size: 1.05rem; line-height: 1; }
.ask-button:hover:not(:disabled, [aria-disabled="true"]) { background: #e4f0ff; }
.ask-button:disabled, .ask-button[aria-disabled="true"] { opacity: .64; cursor: default; }
.suggestions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.suggestions button {
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: .81rem;
  cursor: pointer;
}
.suggestions button:hover:not(:disabled, [aria-disabled="true"]) { color: var(--accent); border-color: #a9c1e085; }
.suggestions button:disabled, .suggestions button[aria-disabled="true"] { opacity: .62; cursor: default; }
.suggestions a {
  display: inline-flex;
  min-height: 34px;
  padding: 6px 5px;
  align-items: center;
  color: var(--muted);
  font-size: .81rem;
  text-underline-offset: .23em;
}
.suggestions a:hover { color: var(--accent); }

.transcript {
  max-height: min(390px, 43svh);
  overflow-y: auto;
  scrollbar-color: #61728b transparent;
  margin-top: 19px;
  padding-right: 8px;
}
.turn { border-top: 1px solid var(--rule); padding: 14px 0; }
.turn:last-child { padding-bottom: 4px; }
.asked { margin: 0 0 8px; color: var(--ink); font-size: .92rem; font-weight: 650; overflow-wrap: anywhere; }
.thinking, .question-error { margin: 12px 0 0; color: var(--accent); font-size: .88rem; }
.question-error { color: #ffc9b1; }
.answer { animation: answer-in .32s ease-out; }
.answer p {
  margin: 0;
  max-width: 54ch;
  color: #d3dce9;
  font-size: .94rem;
  line-height: 1.6;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.citation {
  margin-inline-start: .22em;
  padding: 0 .1em;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--accent);
  font-size: .73rem;
  vertical-align: .12em;
  cursor: pointer;
}
.citation:hover { text-decoration: underline; }
.answer-evidence { margin-top: 9px; }
.answer-evidence summary {
  width: fit-content;
  color: var(--accent);
  font-size: .81rem;
  cursor: pointer;
}
.answer-library-link { display: inline-block; margin-top: 8px; color: var(--accent); font-size: .81rem; }
.sources { display: grid; gap: 9px; margin: 8px 0 0; padding-inline-start: 1.65rem; }
.sources li { color: var(--muted); font-size: .78rem; overflow-wrap: anywhere; }
.sources li:focus { outline: 1px solid var(--rule); outline-offset: 3px; }
.sources a {
  color: var(--accent);
  text-underline-offset: .26em;
  text-decoration-color: #b7d6fd74;
}
.sources a:hover { text-decoration-color: currentColor; }
.sources blockquote {
  margin: 5px 0 0;
  padding-inline-start: .65rem;
  border-inline-start: 1px solid var(--rule);
}
.portfolio-library {
  width: min(950px, calc(100% - var(--gutter) * 2));
  margin: 0 auto clamp(35px, 7vh, 85px);
  padding: 18px 0;
  border-block: 1px solid var(--rule);
  scroll-margin-top: 16px;
}
.portfolio-library > summary {
  width: fit-content;
  color: var(--accent);
  font-size: .98rem;
  cursor: pointer;
}
#portfolio-source-list { margin-top: 14px; color: var(--muted); font-size: .9rem; }
.source-card {
  border-top: 1px solid var(--rule);
  padding: 11px 0;
  scroll-margin-top: 14px;
}
.source-card > summary { cursor: pointer; color: var(--ink); font-weight: 600; }
.source-canonical { display: inline-block; margin-top: 10px; color: var(--accent); font-size: .81rem; }
.source-section {
  max-width: 76ch;
  margin: 14px 0 4px;
  padding: 8px 12px;
  border-inline-start: 1px solid var(--rule);
  scroll-margin-top: 12px;
}
.source-section:target { background: #182637; border-inline-start-color: var(--accent); }
.source-section h2 { margin: 0 0 4px; color: var(--ink); font-size: .88rem; font-weight: 650; }
.source-section p { margin: 0; }
@keyframes answer-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

@media (max-width: 820px) {
  .masthead { min-height: 61px; }
  .experience { grid-template-columns: minmax(0, 1fr); gap: 32px; min-height: auto; padding-block: 22px 36px; }
  .portrait { height: clamp(310px, 45svh, 510px); }
  .conversation { max-width: 600px; }
  .introduction p { margin-top: 12px; }
  .question-form { margin-top: 24px; }
}
@media (hover: none) {
  .suggestions button, .suggestions a { min-height: 44px; }
}
@media (max-width: 370px) {
  .masthead > a { font-size: .9rem; }
}
@media (prefers-reduced-motion: reduce) {
  .portrait, .question-form { transition: none; }
  .answer { animation: none; }
}
