:root {
  --paper: #f6efe3;
  --paper-2: #efe4d2;
  --card: #fffaf2;
  --espresso: #3a1d10;
  --roast: #5b3421;
  --ink: #2b1a12;
  --ink-soft: #6e5647;
  --latte: #c89b6d;
  --latte-ink: #8d5f33;
  --crema: #e3c9a4;
  --line: #dccab2;
  --hotaru: #1a3bb0;
  --wdywe: #cd261c;
  --radius: 18px;
  --serif: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --display: "Playfair Display", "Shippori Mincho", serif;
  --sans: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  --header-h: 60px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  /* Each block (hero / menu / about) settles into place after a short scroll. */
  scroll-snap-type: y mandatory;
  scroll-padding-top: var(--header-h);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.8;
  background-color: var(--paper);
  /* faint paper grain */
  background-image:
    radial-gradient(#3a1d1008 1px, transparent 1px),
    radial-gradient(#3a1d1006 1px, transparent 1px);
  background-size: 22px 22px, 31px 31px;
  background-position: 0 0, 11px 17px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
.wrap { width: min(1040px, 100% - 32px); margin-inline: auto; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: #f6efe3f2; position: sticky; top: 0; z-index: 10; }
.site-header { height: var(--header-h); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 100%; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--espresso); }
.brand img { width: 34px; height: 34px; border-radius: 50%; }
.site-header nav { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.site-header nav a { text-decoration: none; color: var(--ink-soft); }
.site-header nav a:hover { color: var(--espresso); }
.lang { border: 1px solid var(--line); padding: 4px 14px; border-radius: 999px; background: var(--card); }

/* Hero */
.hero {
  padding: 32px 0; text-align: center; scroll-snap-align: start;
  min-height: calc(100svh - var(--header-h)); display: grid; align-content: center;
}
.hero .emblem { width: min(260px, 60vw, 32svh); margin: 0 auto 24px; }
.eyebrow { font-family: var(--display); font-style: italic; color: var(--latte-ink); letter-spacing: 0.08em; margin: 0 0 6px; font-size: 16px; }
.hero h1 { font-family: var(--display); font-size: clamp(28px, 7.4vw, 66px); line-height: 1.1; margin: 0 0 18px; color: var(--espresso); letter-spacing: 0.04em; }
.hero p.lead { font-family: var(--serif); font-size: clamp(16px, 2.2vw, 20px); color: var(--ink-soft); margin: 0 auto; max-width: 30em; }
.divider { display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--latte); margin: 32px auto 0; max-width: 360px; width: 100%; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.divider svg { width: 26px; height: 26px; }

/* Section heading, menu-board style */
section { padding: 64px 0; }
.section-title { text-align: center; margin-bottom: 40px; }
.section-title .en { font-family: var(--display); font-style: italic; color: var(--latte-ink); font-size: 17px; letter-spacing: 0.1em; display: block; }
.section-title h2 { font-family: var(--serif); font-size: clamp(26px, 3.6vw, 36px); margin: 4px 0 8px; color: var(--espresso); }
.section-title p { margin: 0; color: var(--ink-soft); }

/* Menu: exactly one screen tall; the card shrinks to fit instead of overflowing */
#menu {
  scroll-snap-align: start; padding: 20px 0 16px;
  height: calc(100svh - var(--header-h)); min-height: 400px;
  display: flex; flex-direction: column;
}
#menu > .wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#menu .section-title { margin-bottom: 16px; }
#menu .section-title h2 { margin: 0 0 2px; }
#about { scroll-snap-align: start; min-height: calc(100svh - var(--header-h)); display: grid; align-content: center; }
.site-footer { scroll-snap-align: end; }

/* Menu cards — horizontal carousel with ‹ › on either side */
.carousel {
  position: relative; flex: 1; min-height: 0;
  display: grid; grid-template-columns: 56px minmax(0, 1fr) 56px; grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
}
.menu {
  display: grid; grid-auto-flow: column; grid-auto-columns: 100%; gap: 24px;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  overscroll-behavior-x: contain; scrollbar-width: none;
  padding: 4px 2px 20px; /* room for the card shadow */
  height: 100%; min-height: 0; align-items: center;
}
.menu::-webkit-scrollbar { display: none; }
.menu:focus-visible { outline: 2px solid var(--latte-ink); outline-offset: 4px; border-radius: var(--radius); }
.menu > .item { scroll-snap-align: center; scroll-snap-stop: always; max-height: 100%; }
.carousel-btn {
  width: 44px; height: 64px; display: grid; place-items: center; cursor: pointer; justify-self: center;
  border: 0; border-radius: 12px; background: none; color: var(--espresso);
  transition: background 0.15s ease, opacity 0.15s ease;
}
.carousel-btn.prev { grid-column: 1; grid-row: 1; }
.carousel-btn.next { grid-column: 3; grid-row: 1; }
.menu { grid-column: 2; grid-row: 1; }
.carousel-dots { grid-column: 2; grid-row: 2; justify-content: center; }
.carousel-btn svg { width: 30px; height: 30px; }
.carousel-btn:hover:not(:disabled) { background: var(--paper-2); }
.carousel-btn:disabled { opacity: 0.35; cursor: default; }
.carousel-btn:focus-visible, .carousel-dots button:focus-visible { outline: 2px solid var(--latte-ink); outline-offset: 2px; }
.carousel-dots { display: flex; gap: 2px; }
.carousel-dots button {
  width: 36px; height: 32px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center;
}
.carousel-dots button::before {
  content: ""; width: 10px; height: 10px; border-radius: 999px; background: var(--line); transition: width 0.2s ease, background 0.2s ease;
}
.carousel-dots button[aria-current="true"]::before { width: 28px; background: var(--espresso); }
@media (prefers-reduced-motion: reduce) { .menu { scroll-behavior: auto; } }
.item {
  --accent: var(--espresso);
  display: grid; grid-template-columns: 1.25fr 0.75fr; gap: 36px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 32px 40px; position: relative;
  box-shadow: 0 1px 0 #fff inset, 0 18px 40px -24px #3a1d1040;
}
.item::before {
  content: ""; position: absolute; inset: 10px; border: 1px dashed var(--line); border-radius: 12px; pointer-events: none;
}
.item.hotaru { --accent: var(--hotaru); }
.item.wdywe { --accent: var(--wdywe); }
.item-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.item-head img { width: 64px; height: 64px; border-radius: 15px; box-shadow: 0 6px 16px #3a1d1030; }
.item-no { font-family: var(--display); font-style: italic; color: var(--latte-ink); font-size: 15px; display: block; }
.item h3 { font-family: var(--display); font-size: clamp(24px, 3vw, 30px); margin: 0; line-height: 1.2; color: var(--espresso); }
.item .sub { font-family: var(--serif); color: var(--ink-soft); font-size: 15px; }
.item .tagline { font-family: var(--serif); font-size: 19px; color: var(--accent); margin: 0 0 10px; font-weight: 600; }
.item p { margin: 0 0 14px; }
.item ul.points { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 4px; }
.item ul.points li { padding-left: 20px; position: relative; font-size: 15px; }
.item ul.points li::before { content: "☕"; position: absolute; left: 0; font-size: 12px; top: 3px; }
.recipe { border-top: 1px dotted var(--line); padding-top: 12px; margin-bottom: 20px; font-size: 13px; color: var(--ink-soft); }
.recipe b { font-family: var(--display); font-style: italic; font-weight: 400; color: var(--roast); margin-right: 6px; font-size: 14px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 12px; border-radius: 999px; margin-left: auto; white-space: nowrap; }
.badge.live { background: #2f6b3a; color: #fff; }
.badge.soon { background: var(--crema); color: var(--espresso); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 700; font-size: 15px;
  padding: 10px 20px; border-radius: 999px; transition: transform 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--espresso); color: var(--paper); }
.btn.primary:hover { background: var(--roast); }
.btn.ghost { border: 1px solid var(--line); background: transparent; color: var(--espresso); }
.shots { display: flex; justify-content: center; }
.shots img {
  height: clamp(220px, calc(100svh - var(--header-h) - 290px), 500px); width: auto; max-width: 100%; border-radius: 26px;
  border: 7px solid #221510; box-shadow: 0 24px 44px -18px #3a1d1070;
}

/* About */
.about { display: grid; grid-template-columns: 180px 1fr; gap: 36px; align-items: center; max-width: 820px; margin-inline: auto; }
.about img { width: 180px; border-radius: 50%; box-shadow: 0 16px 36px -16px #3a1d1080; }
.about h3 { font-family: var(--serif); margin: 0 0 8px; font-size: 22px; color: var(--espresso); }
.about p { margin: 0 0 10px; color: var(--ink-soft); font-family: var(--serif); }

/* Footer */
.site-footer { background: var(--espresso); color: var(--crema); padding: 40px 0 48px; margin-top: 40px; font-size: 14px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.site-footer .brand { color: var(--paper); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 20px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: #fff; }

@media (max-width: 820px) {
  .about { grid-template-columns: 1fr; text-align: center; }
  .about img { margin-inline: auto; width: 140px; }
  .site-header nav a.hide-sm { display: none; }

  /* Phone: the card is laid out as head / (screenshot | text) / recipe / actions */
  .carousel { margin-inline: -14px; grid-template-columns: 34px minmax(0, 1fr) 34px; }
  .carousel-btn { width: 34px; }
  .carousel-btn svg { width: 24px; height: 24px; }
  #menu { padding: 12px 0 8px; }
  #menu .section-title { margin-bottom: 6px; }
  #menu .section-title .en { font-size: 14px; }
  #menu .section-title h2 { font-size: 24px; }
  #menu .section-title p { display: none; }
  .item {
    grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "head head" "shot tag" "shot desc" "recipe recipe" "actions actions";
    grid-template-rows: auto auto 1fr auto auto; /* extra screenshot height goes under the text, not between it */
    column-gap: 14px; row-gap: 10px; padding: 20px 18px; align-items: start; align-content: center;
  }
  .item > div:first-child { display: contents; }
  .item-head { grid-area: head; margin: 0; gap: 12px; }
  .item-head img { width: 48px; height: 48px; border-radius: 12px; }
  .item h3 { font-size: clamp(16px, 4.6vw, 22px); white-space: nowrap; }
  .item .sub { font-size: 13px; display: block; line-height: 1.5; }
  .shots { grid-area: shot; }
  .shots img { height: clamp(150px, calc(100svh - var(--header-h) - 400px), 230px); border-width: 5px; border-radius: 18px; }
  .item .tagline { grid-area: tag; font-size: 15px; margin: 0; line-height: 1.5; }
  .item .desc { grid-area: desc; font-size: 13px; line-height: 1.6; margin: 0; }
  .item ul.points { display: none; }
  .recipe { grid-area: recipe; margin: 0; padding-top: 8px; font-size: 12px; line-height: 1.6; }
  .actions { grid-area: actions; gap: 8px; }
  .actions { flex-wrap: nowrap; }
  .btn { padding: 7px 14px; font-size: 13px; white-space: nowrap; }
}
@media (max-width: 820px) {
  .item-head { flex-wrap: nowrap; }
  .item-head > div { min-width: 0; }
  .badge { position: absolute; top: 16px; right: 16px; font-size: 11px; padding: 1px 10px; margin: 0; z-index: 1; }
  .item-no { font-size: 13px; }
}
/* Laptops with short screens: the bullets repeat the description, so they go first */
@media (min-width: 821px) and (max-height: 820px) {
  .item ul.points { display: none; }
  .item { padding: 24px 36px; }
  #menu .section-title p { display: none; }
}
/* Short phones (iPhone SE and friends): drop the least important lines so the card still fits */
@media (max-width: 820px) and (max-height: 640px) {
  .item .sub, .recipe { display: none; }
  .item { grid-template-areas: "head head" "shot tag" "shot desc" "actions actions"; grid-template-rows: auto auto 1fr auto; padding: 16px; }
  #menu .section-title .en { display: none; }
  .item .desc { font-size: 12.5px; line-height: 1.55; }
  .item .tagline { font-size: 14px; }
}

/* ---------- Dark mode: "spilled coffee" ---------- */
:root[data-theme="dark"] {
  --paper: #1b120d;
  --paper-2: #2a1c15;
  --card: #241812;
  --espresso: #f1dfc7;
  --roast: #e0c3a0;
  --ink: #eadccb;
  --ink-soft: #bda794;
  --latte-ink: #d9a86f;
  --crema: #6b4a33;
  --line: #4a3527;
  --hotaru: #9bb2ff;
  --wdywe: #ff8a7e;
  color-scheme: dark;
}
:root[data-theme="dark"] body {
  background-image:
    radial-gradient(#ffffff08 1px, transparent 1px),
    radial-gradient(#ffffff05 1px, transparent 1px);
}
:root[data-theme="dark"] .site-header { background: #1b120df2; }
:root[data-theme="dark"] .btn.primary { background: var(--crema); color: #fff6ea; }
:root[data-theme="dark"] .btn.primary:hover { background: #7d5a40; }
:root[data-theme="dark"] .badge.soon { background: #4a3527; color: var(--espresso); }
:root[data-theme="dark"] .site-footer { background: #0f0907; color: #cdb79e; }
:root[data-theme="dark"] .site-footer .brand { color: var(--espresso); }
:root[data-theme="dark"] .item { box-shadow: 0 18px 40px -24px #000c; }

/* Emblem swaps to a cream version on the dark roast */
.emblem-dark { display: none; }
:root[data-theme="dark"] .emblem-light { display: none; }
:root[data-theme="dark"] .emblem-dark { display: block; }

/* The coffee-cup toggle */
.cup-toggle {
  position: fixed; right: 18px; bottom: 18px; z-index: 20;
  width: 60px; height: 60px; border-radius: 50%; padding: 0; cursor: pointer;
  border: 1px solid var(--line); background: var(--card);
  box-shadow: 0 10px 28px -10px #3a1d1080;
  display: grid; place-items: center; transition: transform 0.15s ease;
}
.cup-toggle:hover { transform: translateY(-2px); }
.cup-toggle:focus-visible { outline: 2px solid var(--latte-ink); outline-offset: 3px; }
.cup-toggle svg { width: 44px; height: 44px; overflow: visible; }
.cup-toggle .saucer { fill: #d8c3a8; }
.cup-toggle .cup-body { fill: #fffaf2; stroke: #3a1d10; stroke-width: 1.6; }
.cup-toggle .coffee { fill: #5b3421; }
.cup-toggle .steam { fill: none; stroke: #b08a66; stroke-width: 1.4; stroke-linecap: round; transition: opacity 0.2s ease; }
.cup-toggle .cup { transform-origin: 24px 26px; transition: transform 0.45s cubic-bezier(.5,-0.3,.4,1.4); }
.cup-toggle .puddle { fill: #5b3421; transform-origin: 16px 38px; transform: scale(0, 0); transition: transform 0.35s ease 0.2s; }
.cup-toggle.spilled .cup { transform: translate(4px, -1px) rotate(-90deg); }
.cup-toggle.spilled .steam { opacity: 0; }
.cup-toggle.spilled .puddle { transform: scale(1, 1); }
.cup-toggle.spilled.draining .puddle { transform: scale(0, 0); transition-delay: 0s; }
:root[data-theme="dark"] .cup-toggle .saucer { fill: #4a3527; }

/* Let JS drive the reveal; the new (post-spill) page is masked by a growing splash */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
/* Spilling (to dark): the new page appears through a growing splash. */
.vt-spill::view-transition-new(root) { mask-image: url("/splash.png"); mask-repeat: no-repeat; -webkit-mask-image: url("/splash.png"); -webkit-mask-repeat: no-repeat; }
/* Un-spilling (to light): the old dark page sits on top and shrinks back into the cup. */
.vt-unspill::view-transition-old(root) { z-index: 2; mask-image: url("/splash.png"); mask-repeat: no-repeat; -webkit-mask-image: url("/splash.png"); -webkit-mask-repeat: no-repeat; }
.vt-unspill::view-transition-new(root) { z-index: 1; }
@media (prefers-reduced-motion: reduce) {
  .cup-toggle .cup, .cup-toggle .puddle { transition: none; }
}

/* Smaller cup on phones so it covers less of the menu card (after the base .cup-toggle rules) */
@media (max-width: 820px) {
  .cup-toggle { width: 50px; height: 50px; right: 12px; bottom: 12px; }
  .cup-toggle svg { width: 36px; height: 36px; }
}

/* Phones held sideways (~320–430px tall): squeeze the menu card so it still fits on one screen */
@media (orientation: landscape) and (max-height: 500px) {
  #menu { padding: 6px 0 4px; min-height: 0; }
  #menu .section-title { margin-bottom: 4px; }
  #menu .section-title .en, #menu .section-title p { display: none; }
  #menu .section-title h2 { font-size: 20px; margin: 0; }
  .menu { padding-bottom: 8px; }
  .item {
    grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "shot head" "shot tag" "shot desc" "shot actions";
    grid-template-rows: auto auto 1fr auto; column-gap: 20px; row-gap: 6px; padding: 14px 24px; align-items: start;
  }
  .item > div:first-child { display: contents; }
  .item-head { grid-area: head; margin: 0; }
  .item-head img { width: 40px; height: 40px; border-radius: 10px; }
  .item h3 { font-size: 20px; }
  .item .sub, .item ul.points, .recipe { display: none; }
  .shots { grid-area: shot; order: 0; }
  .shots img { height: max(110px, calc(100svh - var(--header-h) - 130px)); border-width: 5px; border-radius: 16px; }
  .item .tagline { grid-area: tag; font-size: 15px; margin: 0; }
  .item .desc {
    grid-area: desc; font-size: 13px; line-height: 1.6; margin: 0;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
  }
  .actions { grid-area: actions; }
  .btn { padding: 6px 14px; font-size: 13px; }
  .carousel-dots button { height: 22px; }
  .badge { position: absolute; top: 12px; right: 14px; margin: 0; }
  .hero .emblem { width: min(140px, 26svh); margin-bottom: 8px; }
}
@media (orientation: landscape) and (max-height: 340px) {
  .item .desc { -webkit-line-clamp: 2; line-clamp: 2; }
}
