/* =============================================================================
   [Your Name] — personal site
   A warm-paper / Swiss hybrid with Kandinsky accents.
   Hand-built, no framework. Edit the variables below to retheme everything.
   ========================================================================== */

/* ----- 1. Design tokens --------------------------------------------------- */
:root {
  /* Ground + ink (warm paper, never pure white/black) */
  --paper:      #f5f0e6;
  --paper-2:    #efe7d7;   /* recessed panels */
  --paper-3:    #e7ddc9;   /* hairline fills */
  --ink:        #1b1813;   /* warm near-black */
  --ink-2:      #5a534741; /* muted ink (alpha) */
  --ink-soft:   #6a6253;   /* secondary text */

  /* Kandinsky accents — used sparingly */
  --blue:       #2c4f9e;   /* cobalt */
  --red:        #d2462f;   /* vermilion */
  --yellow:     #e7a52b;   /* golden */
  --teal:       #2c7a68;   /* viridian (rare) */
  --violet:     #6a4a93;   /* (rare) */

  /* Line work */
  --rule:       #1b181322; /* hairline rules */
  --rule-2:     #1b181311; /* faint grid */

  /* Type */
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans:  system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono:  "Space Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Fluid type scale */
  --t-display: clamp(2.9rem, 7vw, 6rem);
  --t-h2:      clamp(1.7rem, 3.4vw, 2.7rem);
  --t-h3:      clamp(1.15rem, 1.6vw, 1.4rem);
  --t-body:    clamp(1rem, 0.6vw + 0.9rem, 1.1rem);
  --t-small:   0.8rem;
  --t-label:   0.72rem;

  /* Layout */
  --maxw: 1180px;
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --rad: 3px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ----- 2. Reset ----------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* faint paper tooth */
  background-image:
    radial-gradient(var(--rule-2) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: -11px -11px;
  overflow-x: hidden;
}

img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; }
::selection { background: var(--yellow); color: var(--ink); }

/* ----- 3. Layout helpers -------------------------------------------------- */
/* skip link: offscreen until keyboard focus brings it in */
.skip {
  position: absolute; left: -999px; top: 0.75rem; z-index: 100;
  font-family: var(--mono); font-size: var(--t-small);
  letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none;
  background: var(--ink); color: var(--paper);
  padding: 0.6rem 1rem; border-radius: var(--rad);
}
.skip:focus { left: 0.75rem; }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: clamp(4rem, 9vw, 7.5rem);
  border-top: 1px solid var(--rule);
  position: relative;
}

/* mono section label, e.g. "02 / KENDAMA" */
.label {
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 1.5rem 2rem;
  margin-bottom: clamp(2rem, 4vw, 3.25rem);
}
.section-head h2 {
  font-family: var(--serif);
  font-weight: 460;
  font-optical-sizing: auto;
  font-size: var(--t-h2);
  line-height: 1.04;
  letter-spacing: -0.015em;
  max-width: 16ch;
}
.section-head .lede {
  color: var(--ink-soft);
  max-width: 42ch;
  margin-top: 0.9rem;
}

/* ----- 4. Header / nav ---------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand .mark { width: 26px; height: 26px; flex: none; }

.nav { display: flex; align-items: center; gap: clamp(0.9rem, 2vw, 1.9rem); }
.nav a {
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
  padding: 4px 0;
  position: relative;
  transition: color 0.25s var(--ease);
}
.nav a::after {
  content: "";
  position: absolute; left: 0; bottom: -2px;
  width: 100%; height: 1.5px;
  background: var(--red);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.3s var(--ease);
}
.nav a:hover, .nav a[aria-current="true"] { color: var(--ink); }
.nav a:hover::after, .nav a[aria-current="true"]::after { transform: scaleX(1); }
.nav .nav-toggle { display: none; }
/* on phones the nav wraps to a second row instead of disappearing */
@media (max-width: 680px) {
  .site-header .wrap { flex-wrap: wrap; min-height: 0; padding-block: 0.55rem; row-gap: 0.1rem; }
  .nav { width: 100%; flex-wrap: wrap; gap: 0.15rem 1.1rem; padding-bottom: 0.35rem; }
  .nav .btn { padding: 0.35rem 0.7rem; }
}

/* ----- 5. Hero ------------------------------------------------------------ */
.hero { padding-top: clamp(3rem, 7vw, 5.5rem); padding-bottom: clamp(2.5rem, 5vw, 4rem); border-top: none; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
}
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } }

.hero .eyebrow { margin-bottom: 1.4rem; display: flex; gap: 0.9rem; align-items: center; }
.hero .eyebrow .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--blue); flex: none; }
.hero h1 {
  font-family: var(--serif);
  font-weight: 420;
  font-optical-sizing: auto;
  font-size: var(--t-display);
  line-height: 0.96;
  letter-spacing: -0.025em;
}
.hero h1 em { font-style: italic; color: var(--red); font-weight: 400; }
.hero .tagline {
  margin-top: 1.5rem;
  font-size: clamp(1.05rem, 1.4vw, 1.3rem);
  max-width: 36ch;
  color: var(--ink);
}
.hero .sub { margin-top: 1rem; color: var(--ink-soft); max-width: 44ch; }
.hero-actions { margin-top: 2rem; display: flex; gap: 0.8rem; flex-wrap: wrap; }

/* figure panel (the live warping grid lives here) */
.figure {
  position: relative;
  border: 1px solid var(--ink);
  background: var(--paper-2);
  border-radius: var(--rad);
  overflow: hidden;
}
.figure::before {
  /* registration ticks in the corners — drafting-table flavor */
  content: ""; position: absolute; inset: 8px; pointer-events: none;
  border: 1px solid var(--rule);
}
.figure .stage { display: block; width: 100%; aspect-ratio: 5 / 4.6; }
.figure figcaption {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.6rem 0.85rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  background: var(--paper);
}

/* ----- 6. Buttons / links ------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-family: var(--mono);
  font-size: var(--t-small);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.6rem 1rem;
  border: 1px solid var(--ink);
  border-radius: var(--rad);
  background: var(--ink);
  color: var(--paper);
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--paper); }

.link {
  font-family: var(--mono);
  font-size: var(--t-small);
  letter-spacing: 0.04em;
  text-decoration: none;
  border-bottom: 1.5px solid var(--ink-2);
  padding-bottom: 1px;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.link:hover { border-color: var(--red); color: var(--red); }
.link .arrow { display: inline-block; transition: transform 0.2s var(--ease); }
.link:hover .arrow { transform: translate(2px, -2px); }

/* ----- 7. Configurations strip (homage to the circle-overlap plate) ------- */
.plate {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.plate .wrap { padding-block: 1.4rem; }
.plate-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 0;
  border-left: 1px solid var(--rule);
  border-top: 1px solid var(--rule);
}
.config-cell {
  aspect-ratio: 1;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  display: grid; place-items: center;
  cursor: pointer;
}
.config-cell svg { width: 76%; height: 76%; }

/* ----- 8. Projects -------------------------------------------------------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--rule);          /* shows as hairlines between cards */
  border: 1px solid var(--rule);
}
@media (max-width: 720px) { .projects-grid { grid-template-columns: 1fr; } }
/* with an odd card count, let the closing tile span the full row
   so the grid never shows an empty hairline cell */
.projects-grid > :last-child { grid-column: 1 / -1; }

.card {
  background: var(--paper);
  padding: clamp(1.4rem, 2.5vw, 2rem);
  display: flex; flex-direction: column; gap: 0.9rem;
  position: relative;
  transition: background 0.3s var(--ease);
}
.card:hover { background: var(--paper-2); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.card-no { font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.15em; color: var(--ink-soft); }
.card .icon { width: 40px; height: 40px; flex: none; }
.card h3 {
  font-family: var(--serif); font-weight: 500; font-size: var(--t-h3);
  line-height: 1.1; letter-spacing: -0.01em;
}
.card p { color: var(--ink-soft); font-size: 0.96rem; }
.card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: 0.4rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag {
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-soft);
  border: 1px solid var(--rule); border-radius: 100px;
  padding: 0.18rem 0.55rem;
}
.card-links { display: flex; gap: 0.9rem; }

/* ----- 9. Kendama --------------------------------------------------------- */
.ken-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1.5rem, 3vw, 2.5rem);
}
@media (max-width: 820px) { .ken-grid { grid-template-columns: 1fr; gap: 2rem; } }
.ken-col h3 {
  font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink); padding-bottom: 0.7rem;
  border-bottom: 1.5px solid var(--ink); margin-bottom: 1.1rem;
  display: flex; align-items: center; gap: 0.55rem;
}
.ken-col h3 .swatch { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.entry { padding-block: 0.85rem; border-bottom: 1px solid var(--rule); }
.entry:last-child { border-bottom: none; }
.entry .e-title { font-family: var(--serif); font-size: 1.12rem; font-weight: 500; }
.entry .e-meta { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.05em; color: var(--ink-soft); margin-top: 0.2rem; }
.entry .e-note { font-size: 0.92rem; color: var(--ink-soft); margin-top: 0.35rem; }

.videos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); margin-top: 2.5rem; }
@media (max-width: 720px) { .videos { grid-template-columns: 1fr; } }
.video {
  aspect-ratio: 16/10; position: relative;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 1rem; text-decoration: none; overflow: hidden;
  color: var(--paper); background: var(--ink) center/cover no-repeat;
}
.video::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(to top, rgba(20,18,15,0.9), rgba(20,18,15,0.15) 55%, rgba(20,18,15,0.45));
  transition: opacity 0.3s var(--ease);
}
.video:hover::before { opacity: 0.72; }
.video > * { position: relative; z-index: 1; }
.video .play {
  position: absolute; top: 1rem; right: 1rem; width: 34px; height: 34px;
  border-radius: 50%; border: 1.5px solid var(--paper); display: grid; place-items: center;
  color: var(--paper);
  transition: background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.video:hover .play { background: var(--red); border-color: var(--red); color: var(--paper); }
.video .v-title { font-family: var(--serif); font-size: 1.05rem; font-weight: 500; line-height: 1.15; color: var(--paper); text-shadow: 0 1px 8px rgba(0,0,0,0.5); }
.video .v-meta { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.06em; color: #e7ddc9; margin-top: 0.25rem; text-shadow: 0 1px 6px rgba(0,0,0,0.5); }

/* ----- 10. Academic (bibliography) --------------------------------------- */
.bib { display: flex; flex-direction: column; }
.bib-item {
  display: grid; grid-template-columns: 3.5rem 1fr; gap: 0 1.5rem;
  padding-block: 1.4rem; border-top: 1px solid var(--rule);
  align-items: baseline;
}
.bib-item:last-child { border-bottom: 1px solid var(--rule); }
.bib-no { font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.1em; color: var(--red); padding-top: 0.35rem; }
.bib-title { font-family: var(--serif); font-size: 1.2rem; font-weight: 500; line-height: 1.25; }
.bib-authors { font-size: 0.95rem; color: var(--ink); margin-top: 0.3rem; }
.bib-authors .me { border-bottom: 1.5px solid var(--yellow); }
.bib-venue { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.04em; color: var(--ink-soft); margin-top: 0.4rem; }
.bib-links { display: flex; gap: 1rem; margin-top: 0.7rem; }

/* ----- 11. About / colophon ---------------------------------------------- */
.about-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
@media (max-width: 820px) { .about-grid { grid-template-columns: 1fr; } }
.prose p { max-width: 60ch; }
.prose p + p { margin-top: 1rem; }
.prose .drop::first-letter {
  font-family: var(--serif); font-size: 3.4em; line-height: 0.8;
  float: left; padding: 0.06em 0.12em 0 0; color: var(--blue); font-weight: 500;
}
.note {
  border: 1px solid var(--rule); border-radius: var(--rad);
  background: var(--paper-2); padding: 1.4rem 1.5rem;
}
.note h3 { font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.16em; text-transform: uppercase; margin-bottom: 0.8rem; color: var(--ink); }
.note p { font-size: 0.92rem; color: var(--ink-soft); }
.note p + p { margin-top: 0.7rem; }
.contact { margin-top: 1.4rem; display: flex; flex-direction: column; gap: 0.6rem; }
.contact a { display: inline-flex; gap: 0.6rem; align-items: baseline; width: fit-content; }

/* ----- 12. Footer --------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  padding-block: 2.2rem;
}
.site-footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.site-footer .label { color: #d8cfbd; }
.site-footer a { color: var(--paper); }
.colophon { font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.08em; color: #d8cfbd; }

/* ----- 13. Reveal animation ---------------------------------------------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ----- 14. Circle icon system (shared) ----------------------------------- */
.cc circle { mix-blend-mode: multiply; }
.icon { display: inline-block; vertical-align: middle; line-height: 0; }
.icon svg { width: 100%; height: 100%; display: block; }
.config-cell svg { display: block; }
/* keep the section-head mark from stretching the row on small screens */
@media (max-width: 560px) {
  .section-head { grid-template-columns: 1fr; }
  .section-head .icon { display: none; }
}

/* ----- 15. Bikes ---------------------------------------------------------- */
.bikes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
@media (max-width: 720px) { .bikes-grid { grid-template-columns: 1fr; } }
.bike {
  background: var(--paper);
  padding: clamp(1.1rem, 2.4vw, 1.7rem);
  display: flex; flex-direction: column; gap: 0.9rem;
}
.bike-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.bike-head h3 { font-family: var(--serif); font-weight: 500; font-size: var(--t-h3); line-height: 1.1; }
.bike-head .bike-no { font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.15em; color: var(--ink-soft); }
.bike-fig {
  position: relative; aspect-ratio: 3 / 2;
  border: 1px solid var(--ink); border-radius: var(--rad);
  overflow: hidden; background: var(--paper-2);
}
.bike-fig img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; }
.bike-fig::after { content: ""; position: absolute; inset: 7px; border: 1px solid var(--rule); pointer-events: none; z-index: 2; }
.bike-ph { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 1rem; }
.bike-note { color: var(--ink-soft); font-size: 0.95rem; }
.spec {
  display: grid; grid-template-columns: auto 1fr; gap: 0.34rem 1.1rem;
  margin: 0; padding-top: 0.85rem; border-top: 1px solid var(--rule);
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.02em;
}
.spec dt { color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.1em; }
.spec dd { color: var(--ink); margin: 0; }

/* ----- 16. Hero credentials --------------------------------------------- */
.creds { list-style: none; margin: 1.5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; max-width: 50ch; }
.creds li { position: relative; padding-left: 1.5rem; font-size: 1rem; line-height: 1.45; color: var(--ink); }
.creds li strong { font-weight: 600; }
.creds li::before { content: ""; position: absolute; left: 0; top: 0.45em; width: 10px; height: 10px; border-radius: 50%; border: 1.6px solid var(--ink); }
.creds li:nth-child(3n+1)::before { border-color: var(--blue); }
.creds li:nth-child(3n+2)::before { border-color: var(--red); }
.creds li:nth-child(3n)::before   { border-color: var(--yellow); }

/* ----- 17. Bike gallery (condensed) ------------------------------------- */
.bike-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1rem, 2.5vw, 1.6rem); }
@media (max-width: 760px) { .bike-gallery { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 440px) { .bike-gallery { grid-template-columns: 1fr; } }
.bike-shot { margin: 0; }
.bike-shot figcaption { margin-top: 0.6rem; font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.bike-shot .bike-fig { cursor: zoom-in; }

/* lightbox — click a bike to see the whole frame, uncropped */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.8rem; padding: clamp(1rem, 4vw, 3rem);
  background: rgba(27, 24, 19, 0.93);
  cursor: zoom-out;
  opacity: 0; transition: opacity 0.25s var(--ease);
}
.lightbox.open { opacity: 1; }
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%; max-height: 82vh; width: auto; height: auto;
  object-fit: contain;
  border: 1px solid var(--paper);
  background: var(--ink);
}
.lightbox figcaption {
  font-family: var(--mono); font-size: var(--t-label);
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--paper-3);
}
.lightbox .lb-close {
  position: absolute; top: 1rem; right: 1rem;
  width: 40px; height: 40px; display: grid; place-items: center;
  font-family: var(--mono); font-size: 1.1rem; line-height: 1;
  color: var(--paper); background: transparent;
  border: 1.5px solid var(--paper); border-radius: 50%;
  cursor: pointer;
}
.lightbox .lb-close:hover { background: var(--red); border-color: var(--red); }
@media (prefers-reduced-motion: reduce) { .lightbox { transition: none; } }

/* ----- 18. Selected coursework ------------------------------------------ */
.coursework { margin-top: clamp(2rem, 4vw, 3rem); }
.coursework .label { display: block; margin-bottom: 1rem; }
.course-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 2.5rem; }
@media (max-width: 640px) { .course-list { grid-template-columns: 1fr; } }
.course-list li { display: flex; gap: 0.8rem; align-items: baseline; padding: 0.6rem 0; border-bottom: 1px solid var(--rule); font-size: 0.95rem; color: var(--ink); }
.course-list .code { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.06em; color: var(--red); white-space: nowrap; min-width: 4.5rem; }
