/* ============================================================
   KENTO YAMADA — DIRECTOR
   One page, text only. See DESIGN.md for the full spec this
   implements; only structural deviations explicitly approved in
   chats/chat1.md are made from that spec (see README notes).
   ============================================================ */

:root {
  --paper: #EFEDE8;
  --ink:   #0A0A0A;
  --fog:   #7A776F;
  --rule:  #DCD9D2;

  --edge: clamp(16px, 2.2vw, 40px);
  --void:  clamp(120px, 22vh, 280px);

  --font-chrome: 'Newsreader', Georgia, serif;
  --font-mono: 'M PLUS 1 Code', ui-monospace, 'Source Han Code JP', monospace;

  --fs-name:  clamp(1rem, 1.4vw, 1.25rem);
  --fs-nav:   clamp(.9375rem, 1.1vw, 1.125rem);
  --fs-prose: clamp(1.0625rem, 1.5vw, 1.375rem);
  --fs-mono:  clamp(.71875rem, .82vw, .75rem);
  --fs-label: .6875rem;
}

@media (max-width: 479.98px) {
  :root { --edge: 12px; }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-chrome);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--ink); color: var(--paper); }

a { color: inherit; text-decoration: none; }
a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

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

.edge-x {
  padding-left:  max(var(--edge), env(safe-area-inset-left));
  padding-right: max(var(--edge), env(safe-area-inset-right));
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- hairlines: pierce the whole page, aligned to the works grid ---- */

.hairlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.hairline {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--rule);
  left: -9999px; /* script.js sets the real position once it can measure */
}
@media (max-width: 1199.98px) {
  .hairlines { display: none; }
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--paper);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 1.2em 2.6em;
  padding: clamp(14px, 1.6vw, 26px) max(var(--edge), env(safe-area-inset-right)) clamp(12px, 1.2vw, 20px) max(var(--edge), env(safe-area-inset-left));
}

.brand-name {
  margin: 0;
  font-weight: 300;
  font-size: var(--fs-name);
  letter-spacing: .04em;
  display: flex;
  gap: 1.4em;
  flex-wrap: wrap;
}
.brand-name .role { color: var(--fog); }

.nav {
  display: flex;
  gap: 1.6em;
  font-size: var(--fs-nav);
  letter-spacing: .06em;
}
.nav a { padding-block: .5em; }
@media (hover: hover) and (pointer: fine) {
  .nav a:hover {
    text-decoration: underline;
    text-underline-offset: .35em;
    text-decoration-thickness: 1px;
  }
}
.nav a:focus-visible {
  text-decoration: underline;
  text-underline-offset: .35em;
  text-decoration-thickness: 1px;
}

@media (max-width: 639.98px) {
  /* keep name + nav on one row instead of wrapping to a second line;
     tighten spacing and size first, and only let the row itself
     scroll horizontally (never the page) if it still doesn't fit */
  .site-header {
    flex-wrap: nowrap;
    gap: .6em;
    padding-top: 8px;
    padding-bottom: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .site-header::-webkit-scrollbar { display: none; }
  .brand-name {
    flex: none;
    flex-wrap: nowrap;
    gap: .5em;
    font-size: .8125rem;
    letter-spacing: .01em;
    white-space: nowrap;
  }
  .nav {
    flex: none;
    gap: .7em;
    font-size: .8125rem;
    letter-spacing: .02em;
    white-space: nowrap;
  }
  .nav a { padding-block: .5em; padding-inline: 0; }
}

/* ---- spacing rhythm ---- */

.spacer-first { height: clamp(60px, 15vh, 160px); }
.void { height: var(--void); }
.gap-half { height: clamp(30px, 5.5vh, 70px); }

/* ---- section labels ---- */

main section { position: relative; z-index: 2; }

.section-label {
  margin: 0 0 1.6em;
  font-family: var(--font-chrome);
  font-weight: 300;
  font-size: var(--fs-label);
  letter-spacing: .18em;
  color: var(--fog);
  text-wrap: balance;
}

/* ---- works list ---- */

.works-group { margin-bottom: 1.8em; }
@media (max-width: 1199.98px) {
  .works-group { margin-bottom: 2.4em; }
}

.group-year {
  display: none;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: .06em;
  color: var(--fog);
  font-variant-numeric: tabular-nums;
  margin-bottom: .8em;
}
@media (max-width: 1199.98px) {
  .group-year { display: block; }
}

.work-row {
  display: block;
  color: inherit;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: .03em;
  line-height: 1.5;
  padding-block: .45em;
  overflow-wrap: anywhere;
  hyphens: none;
  /* every row carries this — including plain (non-linked) rows — because
     the same-artist hover graph (script.js) marks whichever rows it
     connects, regardless of link status. CSS only auto-triggers it for
     .is-linked; script.js sets it inline for the rest. */
  background-image: linear-gradient(var(--rule), var(--rule));
  background-repeat: no-repeat;
  background-position: left center;
  background-size: 0% 100%;
  transition: background-size 260ms cubic-bezier(0.16, 1, 0.3, 1);
}
@media (max-width: 1199.98px) {
  /* more breathing room between items in the stacked mobile layout */
  .work-row { padding-block: 1em; }
}

.work-row.is-linked { cursor: pointer; }
@media (hover: hover) and (pointer: fine) {
  .work-row.is-linked:hover { background-size: 100% 100%; }
}
.work-row.is-linked:focus-visible { background-size: 100% 100%; }
.work-row.is-linked:active { background-size: 100% 100%; }

.row-grid--wide {
  display: none;
  grid-template-columns: 6ch 28ch max-content minmax(200px, 1fr) max-content;
  column-gap: 2ch;
  row-gap: .15em;
  align-items: baseline;
}
@media (min-width: 1200px) {
  .row-grid--wide { display: grid; }
}

.cell-year { opacity: .62; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-artist { white-space: nowrap; }
.cell-title {
  display: flex;
  gap: 1ch;
  justify-content: space-between;
  max-width: 78ch;
  white-space: nowrap;
}
.cell-roles { opacity: .62; white-space: nowrap; grid-column: 5; }
.ext { flex: none; }

/* ---- same-artist hover graph (desktop only, script.js) ----
   Purely decorative — it doesn't convey anything not already in the
   plain row text, so it's aria-hidden and skipped entirely below 1200px. */

@keyframes dcDraw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes dcPop { from { opacity: 0; } to { opacity: 1; } }

.works-graph {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
  overflow: visible;
}
.works-graph path {
  fill: none;
  stroke: var(--fog);
  stroke-width: 1;
  stroke-linecap: round;
}
.works-graph circle { fill: var(--ink); }

.works-chip {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  transform: translateY(-50%);
  background: var(--paper);
  border: 1px solid var(--fog);
  border-radius: 3px;
  padding: .35em .6em;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: .03em;
  line-height: 1;
  white-space: nowrap;
  animation: dcPop 200ms linear 160ms both;
}
.works-chip[hidden] { display: none; }

.row-narrow {
  display: flex;
  flex-direction: column;
  gap: .15em;
}
@media (min-width: 1200px) {
  .row-narrow { display: none; }
}
.row-narrow .line2 { opacity: .62; }

/* on touch there's no hover, so give linked rows a static, always-visible
   cue: the ↗ set slightly larger and the line underlined (typographic
   only — no new color, no background, no border). */
.row-narrow .ext { font-size: 1.15em; }
.work-row.is-linked .row-narrow .line1 {
  text-decoration: underline;
  text-underline-offset: .2em;
  text-decoration-thickness: 1px;
}

/* ---- about ---- */

.prose {
  max-width: 92ch;
  font-size: var(--fs-prose);
  line-height: 1.55;
  text-wrap: pretty;
}
.prose p { margin: 0; }

/* ---- awards ---- */

.awards { max-width: 92ch; }

.award {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  column-gap: 2ch;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: .06em;
  line-height: 1.5;
  margin-bottom: 1em;
}
@media (min-width: 1200px) {
  .award { grid-template-columns: 6ch minmax(0, 1fr); }
}
.award-year { color: var(--fog); font-variant-numeric: tabular-nums; }
.award-body { display: block; }
.award-name { display: block; }
.award-work { display: block; color: var(--fog); }

/* ---- contact ---- */

.wipe {
  display: inline-block;
  background-image: linear-gradient(var(--rule), var(--rule));
  background-repeat: no-repeat;
  background-position: left center;
  background-size: 0% 100%;
  transition: background-size 260ms cubic-bezier(0.16, 1, 0.3, 1);
}
@media (hover: hover) and (pointer: fine) {
  .wipe:hover { background-size: 100% 100%; }
}
.wipe:focus-visible { background-size: 100% 100%; }

.email {
  font-family: var(--font-mono);
  font-size: clamp(.875rem, 1.1vw, 1rem);
  letter-spacing: .06em;
  padding: .4em .5em .4em 0;
}

.socials {
  margin: 1.6em 0 0;
  display: flex;
  gap: 1.6em;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: .18em;
  color: var(--fog);
}
.socials a { padding: .6em .4em; }
