/* ==========================================================================
   takumasuda.org
   1. Tokens (colours, type, spacing)   <- change the look here
   2. Base
   3. Header / footer
   4. Shared pieces (buttons, badges, labels, lists)
   5. Home page (hero, work, research, about, contact)
   6. Project pages
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  --paper: #faf8f5;
  --surface: #fffdfa;
  --ink: #1b1a17;
  --ink-2: #4a4740;
  --muted: #827e75;
  --line: #e6e1d8;
  --chip: #f0ece4;
  --a: #8c2839;              /* burgundy: one point of view */
  --b: #1d5c63;              /* teal: the other */

  --sans: "IBM Plex Sans", "IBM Plex Sans JP", system-ui, sans-serif;
  --serif: "IBM Plex Serif", "Shippori Mincho", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --page: 1140px;
  --gutter: clamp(18px, 4vw, 40px);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141211; --surface: #1c1917; --ink: #ede9e2; --ink-2: #c4bfb5; --muted: #958f84;
    --line: #322e2a; --chip: #2a2623; --a: #e58a9a; --b: #74c2c8;
  }
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16.5px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
html:lang(ja) body { line-height: 1.8; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--a); }
:focus-visible { outline: 2px solid var(--b); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
strong { font-weight: 600; }
.wrap { max-width: var(--page); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 100; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 6px; }

/* 3. Header / footer ------------------------------------------------------- */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: var(--page); margin: 0 auto; padding: 18px var(--gutter); }
.brand { font-family: var(--mono); font-size: 12.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; }
.site-header nav { display: flex; align-items: center; gap: 2px; font-size: 14px; overflow-x: auto; scrollbar-width: none; }
.site-header nav::-webkit-scrollbar { display: none; }
.site-header nav a { padding: 7px 12px; border-radius: 999px; white-space: nowrap; color: var(--ink-2); }
.site-header nav a:hover { background: var(--chip); color: var(--ink); }
.site-header nav a.lang { border: 1px solid var(--line); margin-left: 8px; }
.is-page .site-header { border-bottom: 1px solid var(--line); max-width: none; }
.site-footer { max-width: var(--page); margin: 0 auto; padding: 24px var(--gutter) 40px; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }

/* 4. Shared pieces --------------------------------------------------------- */
.label, .eyebrow, .when, .kicker { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.label { color: var(--muted); margin-bottom: 14px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 13px 20px; border-radius: 8px; border: 1.5px solid transparent; font: 600 15px/1.2 var(--sans); cursor: pointer; white-space: nowrap; transition: transform .15s, background .15s; }
.btn:hover { transform: translateY(-1px); }
.btn { background: var(--ink); color: var(--paper); }
.btn:hover { background: var(--a); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: transparent; color: var(--a); border-color: var(--a); }
.btn-accent { background: var(--a); color: #fff; }
.btn-accent:hover { background: var(--b); color: #fff; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.social { display: inline-flex; gap: 4px; align-items: center; }
.social a { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px; color: var(--ink-2); transition: color .15s, transform .15s; }
.social a:hover { color: var(--a); transform: translateY(-1px); }
.social svg { width: 22px; height: 22px; }
.badge { display: inline-block; padding: 5px 11px; border-radius: 999px; background: var(--chip); color: var(--ink-2); font-size: 13px; font-weight: 500; white-space: nowrap; }
.badge-accent { background: var(--a); color: var(--paper); }
.badge-b { background: color-mix(in srgb, var(--b) 14%, transparent); color: var(--b); }
.tags, .badges { display: flex; flex-wrap: wrap; gap: 7px; }
.link-row, .card-links { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 14px; font-weight: 600; }
.link-row a, .card-links a, .directions a, .cv-list a, .prose a, .note a { color: var(--b); }
.link-row a:hover, .card-links a:hover, .directions a:hover, .cv-list a:hover, .prose a:hover { color: var(--a); }
.note, .small { font-size: 14.5px; color: var(--muted); }
.copy { font: 600 11px var(--sans); letter-spacing: .1em; text-transform: uppercase; padding: 6px 11px; border-radius: 6px; border: 1px solid var(--line); background: transparent; color: inherit; cursor: pointer; }
.copy:hover { border-color: currentColor; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details.more > summary { padding: 10px 0; font-size: 14px; font-weight: 600; color: var(--b); }
details.more > summary::after { content: " ↓"; }
details.more[open] > summary::after { content: " ↑"; }

.cv-list > li { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.cv-list > li:first-child { border-top: 0; padding-top: 0; }
.cv-list strong { color: var(--ink); font-size: 16px; }
.cv-list .when { color: var(--muted); letter-spacing: 0; text-transform: none; font-weight: 500; font-size: 14px; padding-top: 2px; }
.timeline > li { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 4px 12px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 14.5px; line-height: 1.55; }
.timeline > li:first-child { border-top: 0; padding-top: 0; }
.timeline .when { color: var(--muted); letter-spacing: 0; text-transform: none; font-weight: 500; font-size: 14px; }
.timeline .badge { display: none; }
.timeline .what { color: var(--ink-2); }
.timeline .what a { color: var(--b); font-weight: 600; }
details.more .timeline > li:first-child { border-top: 1px solid var(--line); padding-top: 12px; }

/* 5. Home page ------------------------------------------------------------- */
/* Hero: two points of view. The portrait is one circle; the coloured one overlaps it. */
.hero { padding: clamp(28px, 5vw, 64px) 0 clamp(40px, 6vw, 80px); overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 400px); gap: 40px 72px; align-items: center; }
.hero .kicker { color: var(--a); margin-bottom: 20px; }
.hero h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(36px, 5.2vw, 64px); line-height: 1.08; letter-spacing: -.025em; max-width: 12.5em; text-wrap: balance; }
html:lang(ja) .hero h1 { font-weight: 600; font-size: clamp(30px, 4.2vw, 50px); line-height: 1.4; letter-spacing: 0; word-break: auto-phrase; }
.intro { margin: 26px 0 30px; max-width: 56ch; font-size: 17.5px; color: var(--ink-2); }
.views { position: relative; aspect-ratio: 1 / 0.92; }
.view { position: absolute; border-radius: 50%; aspect-ratio: 1; }
.view-photo { left: 0; top: 0; width: 78%; height: auto; object-fit: cover; object-position: center 30%; }
.view-other { right: 0; bottom: 6%; width: 58%; background: var(--a); mix-blend-mode: multiply; opacity: .82; transition: transform .9s cubic-bezier(.2, .7, .2, 1); }
.view-ring { right: 6%; top: 2%; width: 34%; border: 1.5px solid var(--b); }
.views figcaption { position: absolute; left: 0; bottom: -6px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
@media (prefers-color-scheme: dark) { .view-other { mix-blend-mode: screen; opacity: .6; } }
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .views { max-width: 300px; order: -1; }
}

.block { padding-top: 72px; padding-bottom: 8px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.block-head h2 { font-family: var(--serif); font-size: clamp(28px, 3.4vw, 38px); font-weight: 500; letter-spacing: -.02em; }
.block-head p { font-size: 14px; color: var(--muted); }

/* Work */
.group { display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); margin: 32px 0 16px; }
.group:first-of-type { margin-top: 0; }
.group .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--a); }
.group-side .dot { background: var(--b); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 22px; }
.card { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 16px; transition: transform .2s, box-shadow .2s; }
.card:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -26px rgba(27, 26, 23, .4); }
.thumb { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 9px; overflow: hidden; background: #1b1a17; margin-bottom: 8px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.card:hover .thumb img { transform: scale(1.03); }
.wordmark { display: flex; height: 100%; align-items: flex-end; padding: 18px; font: 500 26px var(--mono); color: #fff; }
.play { position: absolute; left: 12px; bottom: 12px; padding: 6px 12px; border-radius: 999px; background: rgba(27, 26, 23, .8); color: #fff; font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.card .eyebrow { color: var(--a); letter-spacing: .12em; font-size: 11.5px; }
.group-side + .cards .eyebrow { color: var(--b); }
.card h4 { font-size: 19px; font-weight: 600; letter-spacing: -.015em; line-height: 1.3; }
.tagline { color: var(--ink-2); line-height: 1.5; flex: 1; }
.card-links { margin-top: 8px; align-items: baseline; }
.card-links .year { margin-left: auto; font-weight: 400; color: var(--muted); }

/* Research */
.research-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 36px 56px; }
.statement p { font-size: clamp(18px, 1.9vw, 21px); line-height: 1.55; letter-spacing: -.01em; }
html:lang(ja) .statement p { line-height: 1.85; letter-spacing: 0; }
.statement p + p { margin-top: 14px; color: var(--ink-2); }
.statement .tags { margin-top: 22px; }
.directions { counter-reset: d; }
.directions > li { counter-increment: d; display: grid; grid-template-columns: 34px minmax(0, 1fr); padding: 14px 0; border-top: 1px solid var(--line); }
.directions > li:first-child { border-top: 0; padding-top: 0; }
.directions > li::before { content: counter(d); grid-row: span 2; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--a); margin-top: 1px; }
.directions > li:nth-child(2)::before { background: color-mix(in srgb, var(--a) 50%, var(--b)); }
.directions > li:nth-child(3)::before { background: var(--b); }
.directions h4 { font-size: 16.5px; font-weight: 600; line-height: 1.4; }
.directions p { font-size: 14.5px; line-height: 1.6; color: var(--ink-2); }
.directions a { font-weight: 600; white-space: nowrap; }
.directions + .note { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.pubs-label { margin-top: 44px; }
.pub { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.pub-fig { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); }
.pub-body { display: grid; gap: 6px; align-content: start; }
.pub:not(:has(.pub-fig)) { grid-template-columns: 1fr; }
.pub h3 { font-size: 18px; font-weight: 600; line-height: 1.35; letter-spacing: -.01em; }
.pub-authors, .pub-venue { font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }
.pub-authors strong { color: var(--ink); }
.pub .link-row { margin-top: 4px; }
.bibtex { margin-top: 4px; position: relative; }
.bibtex > summary { font-size: 14px; font-weight: 600; color: var(--b); }
.bibtex .copy { position: absolute; right: 0; top: 0; }
.bibtex pre { margin: 10px 0 0; padding: 14px; overflow-x: auto; background: var(--chip); border-radius: 8px; font: 12.5px/1.6 var(--mono); }
@media (max-width: 760px) { .research-grid { grid-template-columns: 1fr; } .pub { grid-template-columns: 1fr; } }

/* About */
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 40px 56px; padding-top: 40px; border-top: 1px solid var(--line); }
.two-col.lower { margin-top: 40px; }
.label.spaced { margin-top: 36px; }
.offclock { margin-top: 30px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.offclock p:last-child { margin-top: 12px; font-size: 14.5px; color: var(--ink-2); }

/* Contact */
.contact { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 28px 48px; margin-top: 72px; padding-top: 64px; padding-bottom: 72px; border-top: 1px solid var(--line); }
.contact > div:first-child { flex: 1 1 420px; }
.contact h2 { font-family: var(--serif); font-size: clamp(34px, 5vw, 56px); font-weight: 500; line-height: 1.08; letter-spacing: -.025em; }
html:lang(ja) .contact h2 { line-height: 1.3; letter-spacing: -.01em; }
.contact h2 span { color: var(--a); }
.contact p { margin-top: 16px; max-width: 56ch; color: var(--ink-2); }
.contact-actions { display: grid; gap: 14px; justify-items: start; }
.email-out { display: inline-flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 15px; }
.email-out[hidden] { display: none; }
.email-out a { color: var(--b); }

/* 6. Project pages --------------------------------------------------------- */
.is-page main { max-width: 860px; margin: 0 auto; padding: 0 var(--gutter) 72px; }
.project-head { padding: 44px 0 30px; display: grid; gap: 16px; }
.crumb { font-size: 14px; font-weight: 600; }
.crumb a { color: var(--b); }
.project-head h1 { font-family: var(--serif); font-size: clamp(30px, 4.4vw, 46px); font-weight: 500; line-height: 1.12; letter-spacing: -.02em; text-wrap: balance; }
.lede { font-size: clamp(18px, 2vw, 21px); line-height: 1.55; color: var(--ink-2); max-width: 36em; }
.media img, .media iframe, .video { width: 100%; aspect-ratio: 16 / 9; border: 1px solid var(--line); border-radius: var(--radius); background: #1b1a17; display: block; }
.media img { object-fit: cover; }
.media figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); }
.video { position: relative; overflow: hidden; }
.video img { border: 0; border-radius: 0; height: 100%; }
.video:hover .play { background: var(--a); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 28px; margin-top: 32px; border-top: 1px solid var(--line); }
.facts > div { padding: 14px 0; border-bottom: 1px solid var(--line); }
.facts dt { font-size: 11.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.facts dd { font-size: 15px; line-height: 1.5; }
.facts a { color: var(--b); }
.prose { margin-top: 16px; max-width: 66ch; }
.prose h2, .cite h2 { font-size: 12.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--a); margin: 40px 0 12px; }
.prose p, .prose ol, .prose ul { margin-top: 14px; color: var(--ink-2); }
.prose ol { counter-reset: s; display: grid; gap: 10px; }
.prose ol > li { counter-increment: s; padding-left: 36px; position: relative; }
.prose ol > li::before { content: counter(s); position: absolute; left: 0; top: 2px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: #fff; background: var(--b); }
.prose ul > li { padding-left: 18px; position: relative; }
.prose ul > li::before { content: "–"; position: absolute; left: 0; color: var(--muted); }
.prose img { margin: 22px 0; border: 1px solid var(--line); border-radius: var(--radius); }
.cite { margin-top: 12px; }
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 14.5px; font-weight: 600; }
.pager a { color: var(--b); }

/* 7. Web business card (/card/): fits one phone screen ---------------------- */
.ecard-page { min-height: 100svh; display: grid; place-items: center; padding: 16px; }
.ecard { width: 100%; max-width: 400px; padding: 0 22px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 50px -28px rgba(0, 0, 0, .3); overflow: hidden; }
/* Cover: the same two points of view as the home hero. */
.ecard-cover { position: relative; height: 64px; margin: 0 -22px; background: color-mix(in srgb, var(--a) 10%, var(--surface)); overflow: hidden; }
.ecard-cover .c { position: absolute; border-radius: 50%; }
.ecard-cover .c-a { width: 130px; height: 130px; right: 52px; top: -62px; background: var(--a); opacity: .85; }
.ecard-cover .c-b { width: 104px; height: 104px; right: -16px; top: -28px; background: var(--b); mix-blend-mode: multiply; opacity: .8; }
.ecard-cover .c-ring { width: 46px; height: 46px; right: 150px; top: 10px; border: 1.5px solid var(--b); }
@media (prefers-color-scheme: dark) { .ecard-cover .c-b { mix-blend-mode: screen; opacity: .6; } }
.ecard-back { position: absolute; right: 14px; top: 10px; z-index: 1; padding: 4px 10px; border-radius: 999px; background: var(--surface); color: var(--ink-2); font-family: var(--mono); font-size: 12px; }
.ecard-back:hover { color: var(--a); }
.ecard-avatar { position: relative; display: block; width: 72px; height: 72px; margin: -36px 0 12px; border-radius: 50%; object-fit: cover; object-position: center 30%; box-shadow: 0 0 0 4px var(--surface); }
.ecard h1 { font-family: var(--serif); font-weight: 500; font-size: 30px; line-height: 1.1; letter-spacing: -.02em; }
.ecard-title { margin-top: 6px; color: var(--a); font-size: 13.5px; font-weight: 600; }
.ecard-org { margin-top: 10px; padding: 10px 12px; background: var(--chip); border-radius: 10px; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.ecard-org strong { color: var(--ink); font-weight: 600; }
.ecard-org [lang="ja"] { font-family: "IBM Plex Sans JP", var(--sans); font-size: 13px; }
.ecard-links { display: flex; gap: 6px; margin: 12px 0 14px -10px; }
.ecard-links a { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px; color: var(--ink-2); }
.ecard-links a:hover { color: var(--a); }
.ecard-links svg { width: 21px; height: 21px; }
.ecard-actions { display: flex; gap: 10px; }
.ecard-actions .btn { flex: 1; justify-content: center; padding: 11px 14px; }
.ecard-save .g-recaptcha { margin-top: 12px; }
.ecard-save .g-recaptcha[hidden] { display: none; }
.ecard-qrs { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.qr-tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 12px; background: var(--chip); border-radius: 10px; }
.qr-tabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 6px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); font: 500 13px/1.2 var(--sans); cursor: pointer; }
.qr-tabs button svg { width: 15px; height: 15px; }
.qr-tabs button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.ecard-qr { margin: 0 auto; width: min(200px, 52vw); }
.ecard-qr[hidden] { display: none; }
/* QR codes use error correction H, so the centre logo (about 24% wide) still scans. */
.qr-box { position: relative; display: block; padding: 8px; background: #fff; color: #111; border-radius: 6px; }
.qr-box .qr { display: block; width: 100%; height: auto; }
.qr-logo { position: absolute; left: 50%; top: 50%; width: 24%; aspect-ratio: 1; transform: translate(-50%, -50%); display: grid; place-items: center; background: #fff; border-radius: 4px; }
.qr-logo svg { width: 80%; height: 80%; }
@media (max-width: 480px) {
  .ecard-page { padding: 0; place-items: stretch; }
  .ecard { max-width: none; border: 0; border-radius: 0; box-shadow: none; }
}
