/* ryouma — site styles.
   Glass label, glass button, article-heading list, grain overlay and footer
   layout are adapted from ThreeUI Community components (MIT, (c) 2026 Meng To).
   See /licenses.txt. */

@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/instrument-serif.woff2") format("woff2");
}

@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/instrument-serif-italic.woff2") format("woff2");
}

@font-face {
  font-family: "Fragment Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/fragment-mono.woff2") format("woff2");
}

:root {
  --bg: #0b0b0b;
  --ink: #ecece8;
  --ink-soft: #c9c9c3;
  --ink-mute: #8a8a84;
  --ink-faint: #62625e;
  --rule: #2a2a28;
  --accent: #e8c48a;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --mono: "Fragment Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --gutter: clamp(16px, 5vw, 64px);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* film grain over the whole page (ThreeUI article-headings overlay) */
body::after {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  content: "";
  opacity: 0.12;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

main {
  flex: 1 0 auto;
}

a {
  color: inherit;
}

img,
svg,
canvas {
  display: block;
  max-width: 100%;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: var(--gutter);
  top: 12px;
  z-index: 60;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
}

:focus-visible {
  outline: 1.5px solid var(--accent);
  outline-offset: 3px;
}

.mono {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---------------------------------------------------------------- header */

.site-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px var(--gutter);
}

.wordmark {
  font-family: var(--serif);
  font-size: 28px;
  font-style: italic;
  line-height: 1;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: clamp(16px, 3vw, 32px);
}

.site-nav a {
  color: var(--ink-mute);
  text-decoration: none;
  transition: color 0.2s;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink);
}

/* ------------------------------------------------- glass label (ThreeUI) */

.section-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 2px 16px 0;
  overflow: hidden;
  border-radius: 16px;
  color: rgba(255, 255, 255, 0.5);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1em;
  line-height: 1.65;
  text-transform: uppercase;
}

.section-label::before,
.section-label::after {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  content: "";
}

.section-label::before {
  z-index: 3;
  inset: 1.5px;
  background: var(--bg);
}

.section-label::after {
  z-index: 2;
  border: 1.5px solid rgba(255, 255, 255, 0.05);
  opacity: 0.25;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(170deg, #000, transparent 50%);
  mask-image: linear-gradient(170deg, #000, transparent 50%);
}

.section-label__title {
  position: relative;
  z-index: 4;
  opacity: 0.85;
}

.section-label__circle {
  position: absolute;
  z-index: 1;
  top: calc(50% - 100px);
  left: calc(50% - 100px);
  width: 200px;
  height: 200px;
}

.section-label__circle::before {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 180deg at 50% 51%, rgba(255, 255, 255, 0.012) 330deg, #f3dcb4 360deg);
  filter: blur(15px);
  animation: glass-orbit 3.6s linear infinite;
  content: "";
}

/* ------------------------------------------------ glass button (ThreeUI) */

.glass-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  padding: 0 30px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
  font: 600 14px/1.4 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s;
}

.glass-button::before,
.glass-button::after {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  content: "";
}

.glass-button::before {
  background: rgba(23, 23, 23, 0.7);
  box-shadow: inset 2px 4px 16px rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(50px);
  backdrop-filter: blur(50px);
}

.glass-button::after {
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.25);
  opacity: 0.35;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(170deg, #000, transparent 50%);
  mask-image: linear-gradient(170deg, #000, transparent 50%);
}

.glass-button__title {
  position: relative;
  z-index: 4;
}

.glass-button__circle {
  position: absolute;
  z-index: 3;
  top: calc(50% - 100px);
  left: calc(50% - 100px);
  width: 200px;
  height: 200px;
  pointer-events: none;
}

.glass-button__circle::before,
.glass-button__circle::after {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  content: "";
}

.glass-button__circle::before {
  background: conic-gradient(from 180deg, rgba(255, 255, 255, 0.012) 180deg, rgba(255, 255, 255, 0.06) 360deg);
  filter: blur(15px);
  animation: glass-orbit 3.6s linear infinite;
  transition: opacity 0.5s;
}

.glass-button__circle::after {
  inset: 30px;
  background: rgba(255, 255, 255, 0.12);
  opacity: 0;
  filter: blur(5px);
  transform: scale(0.5);
  transition: opacity 0.5s, transform 0.7s;
  -webkit-mask-image: radial-gradient(50% 50%, #000, rgba(23, 23, 23, 0));
  mask-image: radial-gradient(50% 50%, #000, rgba(23, 23, 23, 0));
}

.glass-button:hover .glass-button__circle::before {
  opacity: 0;
}

.glass-button:hover .glass-button__circle::after {
  opacity: 1;
  transform: scale(1);
}

.glass-button:active {
  transform: scale(0.98);
}

@keyframes glass-orbit {
  0% { transform: translate(0) rotate(0); }
  25% { transform: translateX(-30px) rotate(90deg); }
  50% { transform: translate(0) rotate(180deg); }
  75% { transform: translateX(30px) rotate(270deg); }
  100% { transform: translate(0) rotate(360deg); }
}

.text-link {
  color: var(--ink-mute);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: color 0.2s, border-color 0.2s;
}

.text-link:hover {
  color: var(--ink);
  border-color: var(--ink-mute);
}

/* ------------------------------------------------------------------ hero */

.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: min(78vh, 760px);
  margin-top: -76px;
  padding: 140px var(--gutter) clamp(48px, 8vh, 96px);
  overflow: hidden;
  isolation: isolate;
}

.hero__field {
  position: absolute;
  inset: 0;
  z-index: -1;
  /* static fallback when WebGL is not available */
  background-image: radial-gradient(rgba(232, 196, 138, 0.14) 1px, transparent 1.6px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 45%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 70% at 50% 45%, #000 20%, transparent 75%);
}

.hero__field.is-live {
  background-image: none;
  -webkit-mask-image: none;
  mask-image: none;
}

.hero__field canvas {
  width: 100%;
  height: 100%;
}

.hero::after {
  position: absolute;
  inset: auto 0 0;
  z-index: -1;
  height: 40%;
  background: linear-gradient(to top, var(--bg), transparent);
  content: "";
}

.hero__copy {
  max-width: 760px;
}

.hero h1 {
  margin: 20px 0 0;
  font-family: var(--serif);
  font-size: clamp(44px, 8vw, 96px);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.02em;
}

.hero h1 em {
  color: var(--accent);
}

.hero p {
  max-width: 520px;
  margin: 22px 0 0;
  color: var(--ink-soft);
  font-size: clamp(16px, 1.6vw, 19px);
  font-weight: 300;
  text-shadow: 0 0 14px var(--bg), 0 0 4px var(--bg);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 24px;
  margin-top: 32px;
}

/* ------------------------------------- article headings list (ThreeUI) */

.notes {
  padding: clamp(32px, 6vw, 72px) var(--gutter);
  container-type: inline-size;
}

.notes__header {
  display: flex;
  justify-content: space-between;
  padding-bottom: clamp(14px, 2.6cqw, 26px);
  color: var(--ink-faint);
  font: 400 11px / 1 var(--mono);
  letter-spacing: 0.12em;
}

.notes__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.note-row {
  border-top: 1px solid var(--rule);
}

.note-row:last-child {
  border-bottom: 1px solid var(--rule);
}

.note-row a {
  display: grid;
  grid-template-columns: clamp(28px, 4cqw, 56px) minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(10px, 2.2cqw, 30px);
  padding: clamp(20px, 3.2cqw, 36px) 0;
  text-decoration: none;
}

.note-row h2,
.note-row h3 {
  margin: 0;
  color: #e9e9e5;
  font-size: clamp(22px, 3.4cqw, 44px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.02em;
  transition: color 0.2s;
}

.note-row a:hover h2,
.note-row a:hover h3 {
  color: var(--accent);
}

.note-row__index,
.note-row__meta {
  color: #6f6f6a;
  font: 400 11px / 1.3 var(--mono);
  letter-spacing: 0.06em;
}

.note-row__meta {
  text-align: right;
  white-space: nowrap;
}

@container (max-width: 560px) {
  .note-row a {
    grid-template-columns: 28px minmax(0, 1fr);
    row-gap: 10px;
  }

  .note-row__meta {
    grid-column: 2;
    text-align: left;
  }
}

/* -------------------------------------------------------------- now box */

.now {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  padding: 0 var(--gutter) clamp(48px, 8vw, 96px);
}

.now div {
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

.now dt {
  color: var(--ink-faint);
}

.now dd {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.25;
}

@media (max-width: 640px) {
  .now {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}

/* ---------------------------------------------------------------- pages */

.page-head {
  position: relative;
  padding: clamp(40px, 8vw, 96px) var(--gutter) clamp(28px, 4vw, 48px);
  isolation: isolate;
}

.page-head::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgba(232, 196, 138, 0.12) 1px, transparent 1.6px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 60% 90% at 30% 0%, #000 10%, transparent 70%);
  mask-image: radial-gradient(ellipse 60% 90% at 30% 0%, #000 10%, transparent 70%);
  content: "";
}

.page-head__inner {
  max-width: 720px;
  margin: 0 auto;
}

.page-head h1 {
  margin: 18px 0 0;
  font-family: var(--serif);
  font-size: clamp(40px, 7vw, 80px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
}

.page-head .byline {
  margin: 20px 0 0;
  color: var(--ink-faint);
}

.prose {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(40px, 6vw, 72px);
  box-sizing: content-box;
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1.75;
}

.prose > p:first-child::first-letter {
  float: left;
  margin: 6px 10px 0 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 64px;
  line-height: 0.8;
}

.prose p {
  margin: 0 0 1.25em;
}

.prose h2 {
  margin: 2em 0 0.6em;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 400;
  line-height: 1.15;
}

.prose blockquote {
  margin: 1.8em 0;
  padding: 2px 0 2px 22px;
  border-left: 1px solid var(--accent);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 24px;
  font-style: italic;
  line-height: 1.4;
}

.prose blockquote p {
  margin: 0;
}

.prose ul {
  margin: 0 0 1.25em;
  padding-left: 1.2em;
}

.prose li {
  margin-bottom: 0.4em;
}

.prose hr {
  width: 48px;
  margin: 2.4em 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

.prose strong {
  color: var(--ink);
  font-weight: 600;
}

.prose a {
  color: var(--ink);
  text-decoration-color: var(--ink-faint);
  text-underline-offset: 3px;
}

.prose dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 24px;
  margin: 0 0 1.25em;
}

.prose dt {
  color: var(--ink-faint);
  font: 400 11px / 2.4 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.prose dd {
  margin: 0;
}

@media (max-width: 480px) {
  .prose {
    font-size: 17px;
  }

  .prose dl {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .prose dd {
    margin-bottom: 10px;
  }
}

.next-note {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(48px, 8vw, 96px);
  box-sizing: content-box;
}

.next-note__label {
  display: block;
  margin-bottom: 10px;
  color: var(--ink-faint);
}

.next-note__title {
  display: block;
  margin-bottom: 32px;
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.1;
  text-decoration: none;
  transition: color 0.2s;
}

.next-note__title:hover {
  color: var(--accent);
}

/* ------------------------------------------------------------------- 404 */

.lost {
  display: grid;
  place-items: center;
  min-height: 70vh;
  padding: 40px var(--gutter);
  text-align: center;
}

.lost .page-head__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lost h1 {
  font-size: clamp(96px, 22vw, 220px);
  line-height: 0.85;
}

.lost p {
  max-width: 420px;
  margin: 18px auto 32px;
  color: var(--ink-soft);
}

/* -------------------------------------------- footer (ThreeUI newsletter) */

.site-footer {
  position: relative;
  padding: clamp(32px, 5vw, 56px) var(--gutter) 22px;
  overflow: hidden;
  border-top: 1px solid var(--rule);
  container-type: inline-size;
}

.site-footer__row {
  display: flex;
  align-items: center;
  gap: 24px 40px;
  margin-bottom: clamp(18px, 4cqw, 32px);
}

.site-footer__brand {
  display: flex;
  align-items: center;
  min-width: 0;
  margin-right: auto;
}

.site-footer__mark {
  display: grid;
  flex: none;
  width: 48px;
  height: 48px;
  margin-right: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24%;
  place-items: center;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.025));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08), 0 14px 28px rgba(0, 0, 0, 0.28);
  color: rgba(255, 255, 255, 0.82);
  font-family: var(--serif);
  font-size: 24px;
  font-style: italic;
  line-height: 1;
}

.site-footer__brand p {
  margin: 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 15px;
  font-weight: 300;
  line-height: 1.6;
}

.site-footer__nav {
  display: flex;
  gap: 20px;
}

.site-footer__nav a {
  color: var(--ink-mute);
  text-decoration: none;
}

.site-footer__nav a:hover {
  color: var(--ink);
}

.site-footer__wordmark {
  width: 100%;
  color: rgba(248, 248, 248, 0.05);
  font-family: var(--serif);
  font-size: clamp(64px, 18cqw, 220px);
  font-style: italic;
  letter-spacing: -0.04em;
  line-height: 0.85;
  text-align: center;
  white-space: nowrap;
  user-select: none;
}

.site-footer__legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  margin-top: clamp(14px, 3cqw, 28px);
  color: rgba(255, 255, 255, 0.45);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}

.site-footer__legal a {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  transition: color 0.2s;
}

.site-footer__legal a:hover {
  color: #fff;
}

@container (max-width: 640px) {
  .site-footer__row {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
