/* 雨宮製作所 · Amemiya Works — paper, ink and a serif: the look of the business card.
   One stylesheet, light and dark. Fonts are served from /assets/fonts (no external requests). */

@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/source-serif-4-roman.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/source-serif-4-italic.woff2") format("woff2");
  font-weight: 200 900; font-style: italic; font-display: swap;
}

:root {
  --paper: #f6f6f1;
  --surface: #fbfbf8;
  --ink: #1a1a1a;
  --muted: #5f5f59;
  --line: #dcdcd4;
  --shape: #e6e6e0;
  --measure: 46rem;
  --serif: "Source Serif 4", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", Georgia, serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131312;
    --surface: #1a1a18;
    --ink: #ecebe4;
    --muted: #a3a39a;
    --line: #2e2e2a;
    --shape: #1d1d1b;
  }
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); font-family: var(--serif); font-size: 18px; }
body { margin: 0; line-height: 1.65; min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }
:lang(ja) { line-height: 1.9; }
:lang(ja) :is(h1, h2, h3, .lead) { word-break: auto-phrase; }   /* break Japanese between phrases */
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; text-decoration-color: var(--muted); }
a:hover { text-decoration-color: currentColor; }
h1, h2, h3 { font-weight: 500; line-height: 1.2; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.6rem); margin: 0 0 1rem; }
h2 { font-size: 1.3rem; margin: 2.75rem 0 0.75rem; }
.lead { font-size: 1.1rem; color: var(--muted); }

/* ---- header / footer */
.site-header {
  position: relative; z-index: 1;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.75rem;
  padding: 1.4rem max(1.5rem, calc((100% - var(--measure)) / 2));
}
.site-name { display: flex; align-items: center; gap: 0.6rem; color: var(--ink); text-decoration: none; font-variant-caps: all-small-caps; letter-spacing: 0.06em; font-size: 1.1rem; }
.site-name svg { width: 2.1rem; height: auto; }
.site-header nav { display: flex; gap: 1.4rem; flex: 1; }
.site-header nav a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { color: var(--ink); }
.site-header nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--ink); }
.lang-switch a { color: var(--muted); font-size: 0.9rem; }
@media (max-width: 36rem) { .site-header nav { order: 3; flex-basis: 100%; } .site-name { flex: 1; } }

main { position: relative; z-index: 1; flex: 1; width: 100%; max-width: calc(var(--measure) + 3rem); margin: 0 auto; padding: 2rem 1.5rem 5rem; }
.site-footer { position: relative; z-index: 1; color: var(--muted); font-size: 0.85rem; text-align: center; padding: 2rem 1.5rem; }

/* ---- background shapes (the logo's pieces, very light, cut off at the right edge like the card).
   One fixed composition on every page: same size and place, scrolls with the page, never animates. */
body { position: relative; }
.backdrop { position: absolute; top: 15rem; right: -15rem; width: 48rem; color: var(--shape); z-index: 0; pointer-events: none; }
.backdrop svg { width: 100%; height: auto; display: block; }
@media (max-width: 36rem) { .backdrop { top: 22rem; right: -12rem; width: 30rem; } }

/* ---- home: the card */
.card { padding: 2.5rem 0 1rem; }
.affiliation { margin: 0 0 2.5rem; line-height: 1.45; }
.affiliation .institution { font-size: 1.6rem; font-variant-caps: small-caps; letter-spacing: 0.02em; display: block; margin-bottom: 0.35rem; }
:lang(ja) .affiliation .institution { font-variant-caps: normal; letter-spacing: 0.08em; }
.affiliation span:not(.institution) { display: block; font-size: 1.02rem; }
:lang(ja) .affiliation span:not(.institution) { display: inline; margin-right: 1em; }   /* 工学院 システム制御系 天谷研究室, as on the card */
.name { font-size: clamp(1.9rem, 8.4vw, 3.6rem); font-weight: 400; text-transform: uppercase; line-height: 1.12; letter-spacing: 0.01em; margin: 0; }
.name span { display: block; }
.kana { margin: 0.9rem 0 0; font-size: 1.15rem; letter-spacing: 0.12em; }
.intro { margin: 2.5rem 0 0; max-width: 34rem; }
.intro p { margin: 0 0 1rem; }
.button { display: inline-block; margin-top: 0.5rem; padding: 0.45rem 1.2rem; border: 1px solid var(--ink); color: var(--ink); text-decoration: none; font-variant-caps: all-small-caps; letter-spacing: 0.08em; }
.button:hover { background: var(--ink); color: var(--paper); }

/* ---- cards (sections with layout: cards, e.g. the projects) */
.projects { display: grid; margin-top: 1.25rem; border-top: 1px solid var(--line); }
.project { display: flex; gap: 1.2rem; align-items: flex-start; padding: 1.25rem 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.project:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
.project img { width: 7.5rem; aspect-ratio: 4 / 3; object-fit: cover; flex: none; }
.project h3 { margin: 0 0 0.3rem; font-size: 1.2rem; }
.project p { margin: 0 0 0.5rem; color: var(--muted); }
@media (max-width: 30rem) { .project { flex-direction: column; } .project img { width: 100%; } }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; margin: 0; padding: 0; font-variant-caps: all-small-caps; letter-spacing: 0.06em; color: var(--muted); font-size: 0.95rem; }

/* ---- articles */
.prose img, figure img { max-width: 100%; }
figure { margin: 1.75rem 0; }
.prose pre { background: var(--surface); border: 1px solid var(--line); padding: 0.9rem 1rem; overflow-x: auto; font-size: 0.85rem; }
.prose code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.86em; }
.prose blockquote { margin: 1.25rem 0; padding-left: 1rem; border-left: 2px solid var(--line); color: var(--muted); }
.back { margin: 0 0 2rem; }
.back a { text-decoration: none; color: var(--muted); }
.entry .tags { margin-bottom: 1.75rem; }
.meta { color: var(--muted); font-size: 0.85rem; margin-top: 3rem; }
/* sections: a list of entries, the plain layout; dates sit on the right */
.entries { list-style: none; margin: 2rem 0 0; padding: 0; border-top: 1px solid var(--line); }
.entries li { display: flex; gap: 1rem; align-items: baseline; justify-content: space-between; padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.entries a { color: inherit; text-decoration: none; }
.entries a:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
.entries h3 { margin: 0 0 0.25rem; font-size: 1.15rem; }
.entries p { margin: 0; color: var(--muted); }
.entries time, .entry .meta time { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.entry .meta { margin-top: -0.5rem; margin-bottom: 1.75rem; }
.site-footer > :not(:last-child) { margin-bottom: 0.5rem; }

/* ---- 404 / maintenance */
.center { text-align: center; padding: 4rem 0 2rem; }
.center .big { font-size: 5.5rem; font-weight: 300; margin: 0; line-height: 1; letter-spacing: 0.05em; }
.maintenance .mark { width: 6rem; color: var(--ink); animation: breathe 3.5s ease-in-out infinite; }
.maintenance .secondary { margin-top: 1.75rem; color: var(--muted); }
.maintenance .secondary h1 { font-size: 1.3rem; }
@keyframes breathe { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .maintenance .mark { animation: none; } }
.noscript { text-align: center; padding: 3rem 1rem; }
