:root {
  --bg: #f4f3ee;
  /* Pastel pattern: no panel; the ledger ink returns to the daylight-ledger
     palette because the field background is now a fixed light pastel
     gradient. Muted and the band accents are darkened a step beyond the pd
     values so every text color keeps >= 4.5:1 against the lowest-luminance
     part of the gradient (the blue right end). */
  --ink: #141518;
  --muted: #434956;
  --rule: rgba(20, 21, 24, 0.32);
  --rule-subtle: rgba(20, 21, 24, 0.16);
  --aperture-bg: linear-gradient(100deg, #f4c8ea 0%, #e0c9f3 30%, #c6c7f1 52%, #aecdf1 78%, #a5c9ef 100%);
  --focus: #17439f;

  /* Band accents: pd daylight accents, darkened where the pd value alone
     would fall under 4.5:1 on the pastel gradient. Used only for the active
     item's 2px bar and index number (set via --active-accent from field.js). */
  --band-0: #17439f;
  --band-1: #0e4a56;
  --band-2: #463a96;
  --band-3: #7c1d55;
  --band-4: #7e2a14;
  --active-accent: var(--band-2);

  --font-display: "Bahnschrift", "DIN Alternate", "Helvetica Neue", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Bahnschrift", "Helvetica Neue", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-jp: "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", "Hiragino Kaku Gothic ProN", sans-serif;
  --font-mono: "Cascadia Mono", "SF Mono", "SFMono-Regular", Consolas, ui-monospace, monospace;
}

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

html {
  background: var(--aperture-bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  /* Frame of pastel field around the ledger sheet area */
  padding: clamp(26px, 3.4vw, 38px) clamp(24px, 3.4vw, 40px) clamp(42px, 4.6vw, 52px);
  background: var(--aperture-bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.48;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

.sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(22px, 4.2vw, 56px) clamp(16px, 4vw, 48px) clamp(28px, 5vw, 56px);
  /* No panel: the ledger sits directly on the pastel field and is
     structured only by rules and spacing. */
  background: transparent;
  border: 0;
  box-shadow: none;
}

/* Masthead */
.mast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px 24px;
  padding-bottom: clamp(16px, 2.2vw, 24px);
  border-bottom: 1.5px solid var(--ink);
}

.name-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 18px;
}

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 6.2vw, 4.85rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 0.96;
  overflow-wrap: break-word;
}

.name-jp {
  font-family: var(--font-jp);
  font-size: clamp(0.82rem, 1.15vw, 0.96rem);
  font-weight: 400;
  letter-spacing: 0.14em;
  color: var(--muted);
  white-space: nowrap;
}

.affiliation {
  margin: 10px 0 0;
  font-size: clamp(0.88rem, 1.12vw, 1rem);
  color: var(--muted);
  letter-spacing: 0.005em;
  line-height: 1.4;
}

.mast-index {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  color: var(--muted);
  white-space: nowrap;
  padding-bottom: 2px;
}

/* Ledger fills the panel; the aperture now lives in the page background */
.layout {
  padding-top: clamp(22px, 3vw, 36px);
}

.ledger {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 0 clamp(34px, 4vw, 60px);
  min-width: 0;
}

.ledger .section-interests {
  grid-column: 1 / -1;
}

/* Contact and Links share the first ledger row on wide screens, so Links
   sits flush like the first section. The narrow layout restores its rule. */
.ledger .section-links {
  padding-top: 0;
  border-top: 0;
}

.section {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 8px 20px;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
}

.section:first-child {
  padding-top: 0;
  border-top: 0;
}

.section:last-child {
  padding-bottom: 0;
}

.section-label {
  margin: 0;
  padding-top: 3px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--muted);
}

/* Interests */
.interest-list {
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.interest-item {
  position: relative;
  padding: 7px 0 7px 10px;
  margin-left: -10px;
  border-bottom: 1px solid var(--rule-subtle);
  align-items: baseline;
}

.interest-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 2px;
  background: transparent;
}

.interest-item:first-child {
  padding-top: 0;
}

.interest-item:first-child::before {
  top: 2px;
}

.interest-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.interest-item:last-child::before {
  bottom: 2px;
}

.item-index {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.item-name {
  font-size: clamp(0.98rem, 1.2vw, 1.1rem);
  font-weight: 500;
  overflow-wrap: break-word;
}

/* The item name itself is the disclosure control: a button reset to
   inherit the ledger typography exactly. Enter / Space work natively. */
.interest-toggle {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  width: 100%;
  padding: 0;
  margin: 0;
  background: none;
  border: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.interest-desc {
  margin: 6px 0 3px 38px;
  font-size: 0.92rem;
  font-weight: 400;
  line-height: 1.55;
  color: var(--muted);
  max-width: 62ch;
  overflow-wrap: break-word;
}

.interest-desc[hidden] {
  display: none;
}

.interest-item.is-active::before {
  background: var(--active-accent);
}

.interest-item.is-active .item-index {
  color: var(--active-accent);
  font-weight: 600;
}

/* Work */
.work-entry {
  min-width: 0;
}

.work-title {
  margin: 0;
  font-size: clamp(0.98rem, 1.15vw, 1.06rem);
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: break-word;
}

.work-award {
  margin: 5px 0 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
  overflow-wrap: break-word;
}

/* Skills */
.skill-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  font-size: 0.98rem;
}

/* Contact */
.contact-address {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

/* The address itself is the copy control: a button reset to inherit the
   address typography exactly, so the ledger looks unchanged. */
.contact-copy {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: left;
}

/* Links */
.link-list {
  list-style: none;
  margin: -10px 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
}

.link-list a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 32px;
  min-height: 44px;
  padding-inline: 4px;
  margin-inline: -4px;
  color: var(--ink);
  font-size: 0.96rem;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  text-decoration-color: var(--muted);
}

.link-list a:hover {
  color: var(--active-accent);
  text-decoration-color: var(--active-accent);
}

.link-list .arrow {
  font-family: var(--font-mono);
  font-size: 0.8em;
  color: var(--muted);
}

.link-list a:hover .arrow {
  color: var(--active-accent);
}

/* Optical Collective-Decision Aperture as the full-page background */
.aperture {
  background: var(--aperture-bg);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

.aperture-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
}

.aperture-bg:focus-visible {
  outline-offset: -3px;
}

.aperture-fallback,
.aperture-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.aperture.is-live .aperture-fallback {
  opacity: 0;
  pointer-events: none;
}

.aperture-canvas {
  opacity: 0;
}

.aperture.is-live .aperture-canvas {
  opacity: 1;
}

/* Subtle architectural corner registration marks (now at the frame corners) */
.tick {
  position: absolute;
  width: 8px;
  height: 8px;
  pointer-events: none;
  border-color: rgba(20, 21, 24, 0.38);
  border-style: solid;
  border-width: 0;
}

.tick-tl { top: 8px; left: 8px; border-top-width: 1px; border-left-width: 1px; }
.tick-tr { top: 8px; right: 8px; border-top-width: 1px; border-right-width: 1px; }
.tick-bl { bottom: 8px; left: 8px; border-bottom-width: 1px; border-left-width: 1px; }
.tick-br { bottom: 8px; right: 8px; border-bottom-width: 1px; border-right-width: 1px; }

@media (prefers-reduced-motion: no-preference) {
  .interest-item::before {
    transition: background-color 140ms ease-out;
  }

  .item-index {
    transition: color 140ms ease-out;
  }

  .link-list a,
  .link-list .arrow {
    transition: color 120ms ease-out, text-decoration-color 120ms ease-out;
  }
}

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

@media (prefers-contrast: more) {
  :root {
    --ink: #000000;
    --muted: #26292f;
    --rule: rgba(0, 0, 0, 0.55);
    --rule-subtle: rgba(0, 0, 0, 0.3);
  }
}

/* Narrow / Tablet & Mobile Reflow */
@media (max-width: 899px) {
  body {
    padding: 20px 12px 36px;
  }

  .mast {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .mast-index {
    display: none;
  }

  .layout {
    padding-top: 20px;
  }

  .ledger {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .section {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 15px 0;
  }

  .ledger .section-links {
    padding-top: 15px;
    border-top: 1px solid var(--rule);
  }

  .section-label {
    padding-top: 0;
  }
}

@media (max-width: 420px) {
  .sheet {
    padding: 18px 16px 28px;
  }

  h1 {
    font-size: clamp(1.7rem, 8.8vw, 2.25rem);
  }

  .interest-item {
    padding-left: 8px;
    margin-left: -8px;
  }

  .interest-toggle {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 8px;
  }

  .interest-desc {
    margin-left: 32px;
  }

  .skill-list {
    flex-direction: column;
    gap: 4px;
  }

  .link-list {
    gap: 0 20px;
  }
}
