/* =========================================================
   CY THAI — bold serif blog
   Change the whole look from the tokens below.
   ========================================================= */
:root {
  --paper: #f3efe6;      /* warm uncoated-paper background */
  --ink: #16130f;        /* near-black, slightly warm */
  --muted: #7a7266;      /* dates, numbers, captions */
  --rule: #d8d1c3;       /* hairlines */
  --accent: #b5532f;     /* terracotta — links on hover, active filter */

  --display: Arial, "Helvetica Neue", Helvetica, "Noto Sans SC", "Noto Sans JP", "PingFang SC", sans-serif;
  --text: Arial, "Helvetica Neue", Helvetica, "Noto Sans SC", "Noto Sans JP", "PingFang SC", sans-serif;

  --gutter: clamp(16px, 4vw, 48px);
  --measure: 36rem;      /* reading width */
  --page: 72rem;         /* max content width on desktop; margins grow beyond this */
  /* side padding: the normal gutter on small screens, then whatever centres a --page-wide column */
  --side: max(var(--gutter), calc((100% - var(--page)) / 2));
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15130f;
    --ink: #efe9dd;
    --muted: #9a9183;
    --rule: #34302a;
    --accent: #e0835e;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 19px;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }

/* ---------- masthead ---------- */
.masthead {
  padding: 22px var(--side);
  border-bottom: 2px solid var(--ink);
  position: sticky; top: 0; z-index: 10;
  background: var(--paper);  /* so content scrolls under it, not through it */
}
.mast-bar { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.wordmark {
  font-family: var(--display);
  font-weight: 900; font-size: 26px; letter-spacing: -0.02em;
  text-decoration: none;
}
/* "Menu" / "Close" — plain text, like a link */
.menu-toggle {
  display: none;
  font: inherit; font-size: 19px; color: var(--ink);
  background: none; border: 0; padding: 0; cursor: pointer;
}
.menu-toggle[aria-expanded="true"] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.menu-toggle:hover { color: var(--accent); }

/* the dropdown: links stacked on the right, under the button.
   With JavaScript on it floats over the page (no empty band pushing content down). */
.site-nav {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 6px; padding: 18px 0 6px;
  /* same typeface and weight as the Menu / Close button, a little larger */
  font-family: var(--text); font-weight: 400;
  font-size: 22px; line-height: 1.3;
}
.site-nav a { text-decoration: none; }
.site-nav a:hover { color: var(--accent); }
.site-nav a[aria-current] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }

/* with JavaScript on, the menu starts closed and the button opens it
   (without JavaScript the links simply stay visible) */
.js .menu-toggle { display: inline; }
.js .site-nav {
  display: none;
  position: absolute; top: calc(100% + 2px); right: 0;
  padding: 14px var(--side) 18px 32px;
  background: var(--paper);
  border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink);
}
.js .site-nav.open { display: flex; }

main { padding: 0 var(--side); }

/* ---------- home: intro + filters ---------- */
.intro p {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(30px, 5vw, 64px);
  line-height: 1.04; letter-spacing: -0.03em;
  max-width: 15em;
  margin: clamp(40px, 8vw, 96px) 0 clamp(32px, 5vw, 56px);
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.filters button {
  font: inherit; font-size: 15px; color: var(--ink); cursor: pointer;
  background: none; border: 1.5px solid var(--ink); border-radius: 999px;
  padding: 4px 14px;
}
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.filters sup { font-size: 10px; }

/* ---------- home: the index of posts ---------- */
.index { list-style: none; margin: 0 0 96px; padding: 0; border-top: 2px solid var(--ink); }
.index li { border-bottom: 1px solid var(--rule); }
.index a {
  display: grid; grid-template-columns: 3.2em 1fr auto; gap: 0 16px; align-items: baseline;
  padding: 14px 0; text-decoration: none;
}
.index .no, .index .d { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.index .t {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(22px, 3.4vw, 40px); line-height: 1.1; letter-spacing: -0.02em;
}
.index a:hover .t { color: var(--accent); }
@media (max-width: 600px) {
  .index a { grid-template-columns: 1fr auto; }
  .index .t { grid-column: 1 / -1; grid-row: 2; margin-top: 4px; }
}

/* ---------- a post ---------- */
.post { max-width: var(--measure); margin: 0 auto; padding: clamp(40px, 8vw, 88px) 0 64px; }
.post-meta {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  font-size: 14px; color: var(--muted); margin: 0 0 18px;
  font-variant-numeric: tabular-nums;
}
.post-meta .no { color: var(--ink); font-weight: 700; }
.post h1 {
  font-family: var(--display); font-weight: 900;
  font-size: clamp(38px, 7vw, 76px); line-height: 1; letter-spacing: -0.035em;
  margin: 0 0 clamp(32px, 5vw, 56px);
  /* let the title break out of the reading column on wide screens */
  width: min(100%, 14em);
}

.prose > * { margin: 0 0 1.1em; }
.prose h2, .prose h3 {
  font-family: var(--display); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15;
  margin: 1.8em 0 0.6em;
}
.prose h2 { font-size: 1.55em; }
.prose h3 { font-size: 1.25em; }
.prose > h2:first-child { margin-top: 0; font-size: 1.7em; }
.prose strong { font-weight: 700; }
.prose a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover { color: var(--accent); }
.prose blockquote {
  margin-left: 0; padding-left: 1em; border-left: 3px solid var(--ink);
  font-family: var(--display); font-style: italic; font-size: 1.15em;
}
.prose hr { border: 0; text-align: center; margin: 2.4em 0; }
.prose hr::after { content: "＊ ＊ ＊"; color: var(--muted); letter-spacing: 0.5em; }
.prose ul, .prose ol { padding-left: 1.2em; }

/* photos run a little wider than the text */
.prose figure, .prose p:has(> img:only-child) {
  margin: 2em calc(-1 * min(6vw, 64px));
}
.prose figcaption {
  font-size: 15px; line-height: 1.45; color: var(--muted);
  margin: 10px min(6vw, 64px) 0;
}
@media (max-width: 700px) {
  .prose figure, .prose p:has(> img:only-child) { margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); }
  .prose figcaption { margin-left: var(--gutter); margin-right: var(--gutter); }
}

/* Chinese / Japanese posts: a touch more line height */
/* Chinese / Japanese: Noto Sans (Arial has no CJK glyphs) */
:lang(ja) { --display: Arial, "Noto Sans JP", "Noto Sans SC", sans-serif; --text: Arial, "Noto Sans JP", "Noto Sans SC", sans-serif; }
html:lang(zh) .prose, html:lang(ja) .prose { font-weight: 500; line-height: 1.9; letter-spacing: 0.02em; }
html:lang(zh) .prose strong, html:lang(ja) .prose strong { font-weight: 900; }
html:lang(zh) .post h1, html:lang(ja) .post h1, .index .t:lang(zh), .index .t:lang(ja) { font-weight: 900; letter-spacing: 0; }

/* ---------- newer / older ---------- */
.post-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
  margin-top: 72px; padding-top: 20px; border-top: 2px solid var(--ink);
}
.post-nav a { text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 20px; line-height: 1.2; }
.post-nav a span { display: block; font-family: var(--text); font-weight: 400; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.post-nav .older { text-align: right; }
.post-nav a:hover { color: var(--accent); }

/* ---------- footer ---------- */
.foot {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 22px var(--side); border-top: 1px solid var(--rule);
  font-size: 14px; color: var(--muted);
}

/* ---------- about page ---------- */
.about-page { max-width: 58rem; margin: 0 auto; padding: clamp(40px, 8vw, 88px) 0 64px; }
.about-head h1 {
  font-family: var(--display); font-weight: 900;
  font-size: clamp(38px, 7vw, 80px); line-height: 1; letter-spacing: -0.035em;
  margin: 0 0 clamp(32px, 5vw, 56px); max-width: 12em; text-wrap: balance;
}
.about-lead { max-width: var(--measure); }
.about-lead p { margin: 0 0 1.1em; }
.about-lead .lead {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(22px, 2.6vw, 28px); line-height: 1.25; letter-spacing: -0.01em;
}
.about-lead .jp { color: var(--muted); font-size: 16px; }
.cv { margin-top: clamp(48px, 7vw, 80px); }
.cv h2 {
  font-family: var(--display); font-weight: 800; font-size: 15px;
  letter-spacing: 0.08em; text-transform: uppercase;
  margin: 0; padding-bottom: 10px; border-bottom: 2px solid var(--ink);
}
.cv dl { margin: 0; }
.cv dl > div {
  display: grid; grid-template-columns: 8.5em 1fr; gap: 4px 24px;
  padding: 16px 0; border-bottom: 1px solid var(--rule);
}
.cv dt { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.cv dd { margin: 0; min-width: 0; }
.cv dd strong { font-family: var(--display); font-weight: 800; font-size: 1.1em; letter-spacing: -0.01em; }
.cv dd a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.cv dd a:hover { color: var(--accent); }
.cv dd span { display: block; margin-top: 4px; font-size: 16px; line-height: 1.5; color: var(--muted); max-width: 40em; }
.cv.contact p { font-family: var(--display); font-weight: 800; font-size: clamp(22px, 3vw, 32px); margin: 16px 0 0; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .cv dl > div { grid-template-columns: 1fr; }
}

/* ---------- work: photo + title grid ---------- */
.works {
  list-style: none; margin: 0 0 96px; padding: 24px 0 0; border-top: 2px solid var(--ink);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 24px;
}
.works a { display: flex; flex-direction: column; gap: 12px; text-decoration: none; }
.works img { aspect-ratio: 4 / 3; width: 100%; object-fit: cover; background: var(--rule); }
.w-title { font-family: var(--display); font-weight: 800; font-size: 20px; line-height: 1.2; letter-spacing: -0.01em; }
.w-year { font-family: var(--text); font-weight: 400; font-size: 0.85em; color: var(--muted); margin-left: 0.3em; }
.works a:hover .w-title { color: var(--accent); }
@media (max-width: 860px) { .works { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .works { grid-template-columns: 1fr; } }

/* ---------- a project ---------- */
.project { max-width: 72rem; margin: 0 auto; padding: 24px 0 64px; }
.back { display: inline-block; font-size: 15px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--accent); }
.project-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 24px;
  margin: clamp(28px, 5vw, 56px) 0 clamp(24px, 4vw, 40px);
}
.project-head h1 {
  font-family: var(--display); font-weight: 900;
  font-size: clamp(56px, 13vw, 150px); line-height: 0.88; letter-spacing: -0.04em; margin: 0;
}
.project-head .post-meta { margin: 0; }
.project-hero { margin: 0 0 clamp(40px, 6vw, 72px); }

.project-body {
  display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, var(--measure)); gap: 32px clamp(32px, 6vw, 96px);
  margin-bottom: clamp(56px, 8vw, 96px);
}
.project-facts { margin: 0; align-self: start; border-top: 2px solid var(--ink); }
.project-facts > div { display: grid; grid-template-columns: 5.5em 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); font-size: 16px; }
.project-facts dt { color: var(--muted); }
.project-facts dd { margin: 0; min-width: 0; }
.project-text > p { margin: 0 0 1.1em; }
.project-text > p:first-child {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(22px, 2.6vw, 28px); line-height: 1.25; letter-spacing: -0.01em;
}
.project-credits {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px;
  margin-top: 40px; padding-top: 16px; border-top: 2px solid var(--ink);
}
.project-credits h2 { font-family: var(--display); font-weight: 800; font-size: 18px; margin: 0 0 6px; }
.project-credits ul { list-style: none; margin: 0; padding: 0; font-size: 16px; line-height: 1.8; color: var(--muted); }

.project-gallery { margin-bottom: clamp(48px, 7vw, 80px); }
.project-gallery h2 {
  font-family: var(--display); font-weight: 800; font-size: 15px;
  letter-spacing: 0.08em; text-transform: uppercase;
  margin: 0 0 20px; padding-bottom: 10px; border-bottom: 2px solid var(--ink);
}
.gallery-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 32px 24px; align-items: end; }
.gallery-grid figure { margin: 0; grid-column: span 12; }
.gallery-grid .g-half { grid-column: span 6; }
.gallery-grid .g-narrow { grid-column: span 5; }
.gallery-grid .g-wide { grid-column: span 7; }
.gallery-grid figcaption { margin-top: 8px; font-size: 15px; line-height: 1.45; color: var(--muted); }
@media (max-width: 760px) {
  .project-body { grid-template-columns: 1fr; }
  .gallery-grid .g-half, .gallery-grid .g-narrow, .gallery-grid .g-wide { grid-column: span 12; }
}
@media (max-width: 480px) { .project-credits { grid-template-columns: 1fr; } }

/* ---------- home ---------- */
.home-intro {
  font-size: 17px; color: var(--muted); max-width: 32em;
  margin: clamp(32px, 6vw, 64px) 0 clamp(32px, 5vw, 56px);
}
.home-block { margin-bottom: clamp(56px, 8vw, 96px); }
.home-block:first-child { margin-top: clamp(40px, 7vw, 80px); }
.home-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding-bottom: 12px; border-bottom: 2px solid var(--ink);
}
.home-head h2 {
  font-family: var(--display); font-weight: 900; margin: 0;
  font-size: clamp(30px, 4.5vw, 52px); line-height: 1; letter-spacing: -0.03em;
}
.home-head a { font-size: 15px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.home-head a:hover { color: var(--accent); }
.home-block .works { border-top: 0; margin-bottom: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.home-block .index { border-top: 0; margin-bottom: 0; }
.home-dt {
  font-family: var(--text); font-weight: 400;
  font-size: clamp(22px, 2.6vw, 28px); line-height: 1.35;
  max-width: 24em; margin: 20px 0 0;
}
@media (max-width: 520px) { .home-block .works { grid-template-columns: 1fr; } }
