/* ============================================================
   灯火珈琲 -TOMOSHIBI-  |  css/roast.css
   Page-specific layout for 焙煎について.
   Every value derives from tokens.css custom properties.
   The bean-stage swatch colors below are an intentional,
   art-directed extension for the temperature scene only
   (green raw bean -> fox -> charcoal), tuned to the palette.
   ============================================================ */
:root {
  --bean-green: #6a6a3c;   /* 生豆の緑 */
  --bean-fox:   #a6612a;   /* 狐色 */
  --bean-sumi:  #221a12;   /* 墨色（焙じ土寄り） */
}

/* ---- nav toggle (hamburger) ---- */
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 1.4rem;
  height: 1px;
  background: currentColor;
  transform: translateX(-50%);
  transition: transform var(--dur-1) var(--ease-out-quart), opacity var(--dur-1) ease;
}
.nav-toggle span { top: 50%; }
.nav-toggle span::before { top: -6px; }
.nav-toggle span::after { top: 6px; }
.site-nav.nav-open .nav-toggle span { background: transparent; }
.site-nav.nav-open .nav-toggle span::before { transform: translateX(-50%) translateY(6px) rotate(45deg); }
.site-nav.nav-open .nav-toggle span::after { transform: translateX(-50%) translateY(-6px) rotate(-45deg); }

/* ============ HERO ============ */
.hero {
  position: relative;
  min-height: 90vh;
  padding-block: calc(var(--nav-h) + var(--space-5)) var(--space-6);
  display: flex;
  align-items: center;
  overflow: hidden;
}
.hero__inner {
  width: 100%;
  align-items: end;
  row-gap: var(--space-5);
}
.hero__ghost {
  top: 8vh;
  right: -0.06em;
  font-size: clamp(5rem, 26vw, 22rem);
  z-index: 0;
}
.hero__headline {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  position: relative;
  z-index: 1;
}
.hero__label {
  writing-mode: vertical-rl;
  margin-top: 0.4em;
}
.hero__title {
  font-size: clamp(3.4rem, 9vw, 8.5rem);
  font-weight: 700;
  line-height: 0.98;
  height: min(66vh, 40rem);
}
.hero__title span { display: block; }
.hero__body {
  position: relative;
  z-index: 1;
  max-width: 44ch;
  justify-self: end;
}
.hero__lede {
  font-size: var(--step-1);
  line-height: 1.85;
  font-weight: 300;
  color: var(--color-fg);
  /* whole-block reveal now (not char-split); tighten measure so no lone 'す。' orphan */
  max-width: 40ch;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.hero__scrollcue {
  display: inline-block;
  margin-top: var(--space-4);
}

/* ============ STORY ============ */
.story { position: relative; overflow: hidden; }
.story__weave {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    repeating-linear-gradient(90deg, rgba(139,125,104,0.045) 0 1px, transparent 1px 15px),
    repeating-linear-gradient(0deg, rgba(139,125,104,0.045) 0 1px, transparent 1px 15px);
  -webkit-mask-image: radial-gradient(120% 90% at 30% 40%, #000 0%, transparent 78%);
  mask-image: radial-gradient(120% 90% at 30% 40%, #000 0%, transparent 78%);
}
.story__grid { position: relative; z-index: 1; align-items: start; row-gap: var(--space-5); }
.story__head {
  position: relative;
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
  min-height: clamp(18rem, 40vh, 30rem);
}
.story__chapter { color: var(--color-muted); font-family: var(--font-mincho); margin-top: 0.3em; }
.story__title {
  font-size: clamp(2.6rem, 7vw, 6rem);
  font-weight: 600;
  height: clamp(15rem, 34vh, 26rem);
}
.story__title span { display: block; }
.ghost-num {
  position: absolute;
  left: 50%;
  bottom: -0.15em;
  transform: translateX(-30%);
  font-weight: 900;
  font-size: clamp(4rem, 15vw, 13rem);
  color: var(--ghost-word);
  font-variant-numeric: tabular-nums;
  z-index: -1;
}
.story__body {
  align-self: center;
  font-size: var(--step-0);
}
.story__body p { max-width: 46ch; }

/* ============ TEMPERATURE ============ */
.temp { position: relative; }
.temp__intro {
  max-width: 70rem;
  margin-bottom: var(--space-6);
}
.temp__intro .label { display: block; margin-bottom: var(--space-2); }
.temp__title { font-size: var(--step-2); margin-bottom: var(--space-3); }
.temp__lede { max-width: 52ch; color: var(--color-fg); }

.temp__stage {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: var(--space-5);
  overflow: hidden;
}
.temp__inner {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: var(--gutter);
  align-items: center;
  width: 100%;
}
.temp__panel {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--color-surface);
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid var(--hairline);
}
.temp__swatch {
  position: absolute;
  inset: 0;
  background: var(--bean-sumi);
  transition: background 0.15s linear;
}
.temp__bean {
  position: relative;
  width: 46%;
  height: auto;
  color: var(--color-fg);
  opacity: 0.72;
  mix-blend-mode: screen;
}
.temp__readout { position: relative; padding-left: var(--space-3); }
.temp__figure { display: flex; align-items: baseline; gap: 0.15em; }
.temp__num {
  font-family: var(--font-display);
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  font-optical-sizing: auto;
  font-size: clamp(5rem, 22vw, 16rem);
  line-height: 0.78;
  letter-spacing: -0.04em;
  color: var(--color-fg);
}
.temp__unit {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(1.6rem, 5vw, 3.4rem);
  color: var(--color-accent);
}
.temp__phase {
  font-family: var(--font-mincho);
  font-size: var(--step-1);
  color: var(--color-fg);
  margin-top: var(--space-2);
  min-height: 1.4em;
}
.temp__cracks {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: var(--space-3);
  height: 100%;
  align-items: flex-start;
  padding-top: var(--space-2);
}
.temp__crack {
  font-size: var(--step-1);
  color: var(--color-accent);
  opacity: 0;
  transform: translateY(-0.6em);
  transition: opacity var(--dur-2) var(--ease-out-quart), transform var(--dur-2) var(--ease-out-quart);
  height: 4.5em;
}
.temp__crack.is-lit { opacity: 1; transform: translateY(0); }

.temp__scale {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  margin-top: var(--space-5);
  padding-top: var(--space-3);
  border-top: 1px solid var(--hairline);
}
.temp__scale li {
  display: flex;
  align-items: baseline;
  gap: 0.5em;
  font-size: var(--step--1);
  color: var(--color-muted);
}
.temp__scale .tnum { font-size: var(--step-0); color: var(--color-fg); }
.temp__scale-note { letter-spacing: 0.02em; }

/* ============ FOUR STAGES ============ */
.stages { position: relative; overflow: hidden; }
.stages__smoke {
  position: absolute;
  left: clamp(0.5rem, 4vw, 4rem);
  top: 8%;
  width: 24px;
  height: 84%;
  z-index: 0;
  pointer-events: none;
}
.stages__head { margin-bottom: var(--space-5); position: relative; z-index: 1; }
.stages__head .label { display: block; margin-bottom: var(--space-2); }
.stages__title { font-size: var(--step-2); }
.stages__title span { display: inline; }
.stages__list { position: relative; z-index: 1; }
.stages__row {
  display: grid;
  grid-template-columns: clamp(3rem, 8vw, 6rem) clamp(2.4rem, 5vw, 3.5rem) 1fr;
  gap: var(--gutter);
  align-items: center;
  padding-block: var(--space-4);
  border-top: 1px solid var(--hairline);
}
.stages__row:last-child { border-bottom: 1px solid var(--hairline); }
.stages__num {
  font-family: var(--font-mincho);
  font-weight: 500;
  font-size: clamp(2.6rem, 7vw, 5rem);
  line-height: 0.8;
  color: var(--color-muted);
}
.stages__name {
  font-size: var(--step-1);
  font-weight: 600;
  color: var(--color-fg);
  height: 5.2em;
  align-self: start;
}
.stages__desc {
  max-width: 42ch;
  font-size: var(--step-0);
  color: var(--color-fg);
}

/* ============ CREED ============ */
.creed { position: relative; }
.creed__inner { align-items: center; row-gap: var(--space-5); padding-block: var(--space-7); }
.creed__headwrap { display: flex; }
.creed__title {
  font-size: clamp(2.8rem, 8vw, 7rem);
  font-weight: 600;
  height: clamp(15rem, 42vh, 30rem);
}
.creed__title span { display: block; }
.creed__body { align-self: center; }
.creed__body p { max-width: 44ch; font-size: var(--step-1); line-height: 1.85; font-weight: 300; }
.silence--wide { height: clamp(20vh, 30vh, 40vh); }

/* ============ FOOTER ============ */
.site-footer {
  margin-top: var(--space-6);
  padding-bottom: var(--space-5);
  position: relative;
}
.site-footer .marquee { padding-block: var(--space-4); }
.footer__grid {
  align-items: start;
  row-gap: var(--space-5);
  padding-top: var(--space-5);
}
.footer__brand {
  font-weight: 900;
  font-size: 12vw;
  line-height: 0.82;
  color: var(--color-fg);
  letter-spacing: -0.03em;
}
.footer__tagline {
  font-family: var(--font-mincho);
  color: var(--color-muted);
  margin-top: var(--space-2);
  font-size: var(--step-0);
}
.footer__nav {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-4);
}
.footer__navlink {
  height: 6.5em;
  font-family: var(--font-mincho);
  font-size: var(--step-0);
  color: var(--color-fg);
  transition: color var(--dur-1) var(--ease-out-quart);
}
.footer__navlink:hover,
.footer__navlink:focus-visible { color: var(--color-accent); }
.footer__navlink[aria-current="page"] { color: var(--color-accent); }
.footer__contact {
  display: flex;
  flex-direction: column;
  gap: 0.35em;
  font-style: normal;
  font-size: var(--step--1);
  color: var(--color-muted);
  line-height: 1.8;
}
.footer__name { color: var(--color-fg); font-family: var(--font-mincho); font-size: var(--step-0); }
.footer__mail { color: var(--color-fg); }
.footer__copy {
  align-self: end;
  text-align: right;
  font-size: var(--step--1);
  color: var(--color-muted);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .temp__inner { grid-template-columns: 1fr; gap: var(--space-4); }
  .temp__panel { aspect-ratio: 16 / 10; max-width: 26rem; }
  .temp__cracks { position: static; height: auto; padding-top: var(--space-3); }
  .temp__crack { height: 3.5em; }
}
@media (max-width: 720px) {
  .hero { min-height: 82vh; }
  .hero__inner { align-items: start; }
  .hero__title { height: min(60vh, 30rem); font-size: clamp(3rem, 15vw, 6rem); }
  .hero__body { justify-self: start; }
  .story__head { min-height: 20rem; }
  .story__title { height: 16rem; }
  .ghost-num { position: static; transform: none; display: block; margin-top: var(--space-3); }
  .stages__row { grid-template-columns: clamp(2.4rem, 12vw, 4rem) 1fr; }
  .stages__name { grid-row: 1; height: auto; writing-mode: horizontal-tb; }
  .stages__desc { grid-column: 1 / -1; }
  .footer__brand { font-size: 18vw; }
  .footer__nav { justify-content: flex-start; }
  .footer__copy { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .temp__crack { opacity: 1 !important; transform: none !important; }
  .temp__stage { min-height: auto; }
}
