/* Minimal personal page — calm type, lots of air */

:root {
  --bg: #f7f6f3;
  --fg: #1a1a18;
  --muted: #5c5a56;
  --accent: #2d4a3e;
  --rule: rgba(26, 26, 24, 0.12);
  --max: 34rem;
  --max-wide: min(58rem, calc(100vw - 2 * var(--pad)));
  --pad: clamp(1.25rem, 4vw, 2.5rem);
  /* Widen fixed photo into the “center” band; text shifts right to match */
  --photo-extra: clamp(1.5rem, 4vw, 3.25rem);
  --photo-scale: 1.25;
}

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

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

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  --text-col: min(var(--max), 100vw);
  --side-gutter: max(0px, calc((100vw - var(--text-col)) / 2));
  --photo-rail-width: calc(
    (var(--side-gutter) + var(--photo-extra)) * var(--photo-scale)
  );
  font-family: "JetBrains Mono", ui-monospace, "Cascadia Code", "SF Mono",
    Menlo, monospace;
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.65;
  letter-spacing: -0.01em;
  color: var(--fg);
  background: var(--bg);
  transition: background-color 220ms ease, color 220ms ease;
}

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

.skip:focus {
  position: fixed;
  top: var(--pad);
  left: var(--pad);
  z-index: 100;
  width: auto;
  height: auto;
  margin: 0;
  clip: auto;
  padding: 0.5rem 0.75rem;
  background: var(--fg);
  color: var(--bg);
  text-decoration: none;
}

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

/* Left strip: symmetric gutter + extra width so the subject reads larger; text column nudges right */
.photo-rail {
  position: fixed;
  z-index: 0;
  left: 0;
  top: 0;
  width: var(--photo-rail-width);
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--pad);
  pointer-events: none;
}

.margin-photo {
  margin: 0;
  width: 100%;
  max-width: 100%;
}

.margin-photo__img {
  width: 100%;
  height: auto;
  max-height: min(96dvh, calc(62rem * var(--photo-scale)));
  display: block;
  object-fit: contain;
  border-radius: 3px;
  opacity: 0.94;
}

.shell {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--max);
  margin-left: var(--photo-rail-width);
  margin-right: auto;
  padding: clamp(2.5rem, 8vh, 5rem) var(--pad) 3rem;
}

body.no-photo .shell {
  margin-left: auto;
  margin-right: auto;
}

body.wide-page .shell {
  max-width: var(--max-wide);
}

.sidequests-page .shell {
  max-width: 40rem;
}

.sidequests-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}

.sidequests-item {
  margin: 0;
  border-bottom: 1px solid var(--rule);
}

.sidequests-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  color: inherit;
  text-decoration: none;
}

.sidequests-link:hover .sidequests-title {
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.sidequests-title {
  color: var(--accent);
}

.sidequests-date {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.page {
  margin: 0;
  min-width: 0;
}

.masthead {
  margin-bottom: 2.75rem;
}

.masthead__line {
  margin: 0 0 1rem;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.name {
  margin: 0;
  font-family: "Instrument Serif", Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 6vw, 2.75rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0.85rem 0 0;
  max-width: 28rem;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--muted);
}

.subtitle--next {
  margin-top: 0.4rem;
}

.subtitle__link {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

.subtitle__link:hover {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.subtitle__link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

.block {
  margin: 0;
}

.lede {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--fg);
}

.section-label {
  margin: 0 0 0.65rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-label--lower {
  letter-spacing: 0.04em;
  text-transform: none;
}

.about-block .section-label {
  margin-bottom: 0.35rem;
}

.about-controls {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  margin: 0 0 0.15rem;
}

.about-toggle,
.about-skip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease,
    transform 160ms ease, opacity 160ms ease;
}

.about-toggle:hover,
.about-skip:hover {
  color: var(--fg);
  border-color: var(--rule);
  background: color-mix(in srgb, var(--fg) 4%, transparent);
}

.about-toggle:focus-visible,
.about-skip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.about-toggle__arrow {
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform 220ms ease;
}

/* Only flip once typing is finished — not while text is still writing out */
.about-block.is-open.is-typed .about-toggle__arrow {
  transform: rotate(225deg) translateY(-1px);
}

.about-skip[hidden] {
  display: none;
}

.about-skip__arrows {
  position: relative;
  width: 0.55rem;
  height: 0.7rem;
}

.about-skip__arrows::before,
.about-skip__arrows::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 0.38rem;
  height: 0.38rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateX(-50%) rotate(45deg);
}

.about-skip__arrows::before {
  top: 0;
}

.about-skip__arrows::after {
  top: 0.28rem;
}

.about-panel {
  margin-top: 0.85rem;
  overflow: hidden;
}

.about-output {
  white-space: pre-wrap;
  min-height: 1.5em;
}

.about-output::after {
  content: "";
  display: inline-block;
  width: 0.5ch;
  height: 1em;
  margin-left: 0.08ch;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: about-caret 1s steps(1) infinite;
}

.about-block.is-typed .about-output::after {
  display: none;
}

.about-output p {
  margin: 0;
}

.about-output p + p {
  margin-top: 1em;
}

.about-block.is-typed .about-output {
  white-space: normal;
}

@keyframes about-caret {
  50% {
    opacity: 0;
  }
}

.body {
  margin: 0;
  color: var(--muted);
}

.body code {
  font-size: 0.875em;
}

.body--teaser {
  margin-top: 1.25rem;
  font-size: 0.8125rem;
  font-style: italic;
}

.essay-meta {
  margin: 0 0 0.75rem;
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.essay-stage {
  position: relative;
  min-height: 12rem;
  padding: 0;
  cursor: text;
  outline: none;
}

.essay-stage:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
}

.essay-text {
  margin: 0;
  display: inline;
  white-space: pre-wrap;
  font-family: "JetBrains Mono", ui-monospace, "Cascadia Code", "SF Mono",
    Menlo, monospace;
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.75;
  letter-spacing: -0.01em;
  color: var(--muted);
}

.essay-caret {
  display: inline-block;
  width: 0.55ch;
  height: 1.05em;
  margin-left: 0.05ch;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: essay-blink 1s steps(1) infinite;
}

.essay-stage.is-complete .essay-caret {
  display: none;
}

@keyframes essay-blink {
  50% {
    opacity: 0;
  }
}

.essay-hint {
  margin: 1.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.essay-skip {
  margin-top: 0.85rem;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}

.essay-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--rule);
  border-radius: 3px;
  overflow: hidden;
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.subsection-label {
  margin: 1.25rem 0 0.55rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--fg);
}

.detail-list {
  margin: 0.65rem 0 0;
  padding-left: 1.15rem;
  color: var(--muted);
}

.detail-list li {
  margin: 0.4rem 0;
}

.detail-list strong {
  color: var(--fg);
  font-weight: 500;
}

.links {
  margin: 0;
  padding: 0;
  list-style: none;
}

.links li {
  margin: 0;
  padding: 0.65rem 0;
  border-top: 1px solid var(--rule);
}

.links li:last-child {
  border-bottom: 1px solid var(--rule);
}

.sidequests-more {
  margin-top: 0.7rem;
}

.sidequests-more .link {
  font-size: 0.85em;
}

.link {
  display: inline;
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 0.22em;
  transition: color 0.15s ease;
}

.link:hover {
  color: var(--fg);
  text-decoration: underline;
}

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

.footer {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

.footer__note {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.masthead__line,
.subtitle,
.section-label,
.body,
.footer__note,
.links li,
.link,
.subtitle__link,
.theme-toggle,
.site-copyright {
  transition: color 220ms ease, border-color 220ms ease, background-color 220ms ease;
}

.site-footer-controls {
  position: fixed;
  left: max(0.55rem, env(safe-area-inset-left));
  bottom: max(0.55rem, env(safe-area-inset-bottom));
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  max-width: calc(100vw - 1.1rem - env(safe-area-inset-left) - env(safe-area-inset-right));
  pointer-events: none;
}

.site-footer-controls > * {
  pointer-events: auto;
}

.site-copyright {
  margin: 0;
  font-size: 0.5625rem;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: var(--muted);
  opacity: 0.2;
  white-space: nowrap;
}

.theme-toggle {
  flex: 0 0 auto;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  display: grid;
  place-items: center;
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  background: color-mix(in srgb, var(--bg) 92%, var(--fg) 8%);
  color: var(--muted);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.6rem;
  line-height: 0;
  cursor: pointer;
  opacity: 0.42;
  transition: opacity 160ms ease, color 160ms ease, border-color 160ms ease,
    background-color 220ms ease;
}

.theme-toggle:hover {
  color: var(--fg);
  border-color: color-mix(in srgb, var(--fg) 20%, var(--rule) 80%);
  opacity: 0.96;
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  opacity: 0.96;
}

@media (max-width: 42rem) {
  .photo-rail {
    position: static;
    width: 100%;
    height: auto;
    max-width: min(18rem, 86vw);
    margin: 0 auto;
    padding: 0 var(--pad) 2rem;
    pointer-events: auto;
    order: 2;
  }

  .photo-rail .margin-photo__img {
    max-height: none;
  }

  .shell {
    order: 1;
    max-width: var(--max);
    margin-left: auto;
    margin-right: auto;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121210;
    --fg: #e8e6e1;
    --muted: #9c9890;
    --accent: #8fbc9f;
    --rule: rgba(232, 230, 225, 0.1);
  }
}

html[data-theme="light"] {
  --bg: #f7f6f3;
  --fg: #1a1a18;
  --muted: #5c5a56;
  --accent: #2d4a3e;
  --rule: rgba(26, 26, 24, 0.12);
}

html[data-theme="dark"] {
  --bg: #121210;
  --fg: #e8e6e1;
  --muted: #9c9890;
  --accent: #8fbc9f;
  --rule: rgba(232, 230, 225, 0.1);
}

@media (prefers-reduced-motion: reduce) {
  body,
  .masthead__line,
  .subtitle,
  .section-label,
  .body,
  .footer__note,
  .links li,
  .link,
  .subtitle__link,
  .theme-toggle,
  .site-copyright,
  .essay-caret {
    transition: none;
  }

  .essay-caret {
    animation: none;
  }

  .about-toggle,
  .about-skip,
  .about-toggle__arrow {
    transition: none;
  }

  .about-output::after {
    animation: none;
  }

  .link,
  .subtitle__link {
    transition: none;
  }
}
