/* ==========================================================================
   Tokens
   ========================================================================== */
:root {
  --bg: #eae6dc;
  --paper: #f4f1e9;
  --ink: #262420;
  --ink-soft: #6e6a5f;
  --line: rgba(38, 36, 32, 0.14);

  --moss: #5c6b52;
  --moss-ink: #f4f1e9;
  --clay: #9c6b4f;
  --clay-ink: #f4f1e9;
  --slate: #55677a;
  --slate-ink: #f4f1e9;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "SF Mono", Consolas,
    "Liberation Mono", Menlo, monospace;

  /* fluid tile unit: grows/shrinks continuously with viewport width,
     column COUNT stays fixed above the mobile breakpoint, so tile
     positions never jump -- only their size does. */
  --tile-unit: clamp(84px, 11.5vw, 168px);
  --gap: clamp(6px, 1.2vw, 14px);
  --cols: 6;

  --header-h: 64px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.site-name {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.site-name small {
  display: block;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  text-transform: uppercase;
  margin-top: 2px;
}

.burger {
  appearance: none;
  border: none;
  background: transparent;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.burger .bars {
  position: relative;
  width: 22px;
  height: 14px;
}

.burger .bars span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--ink);
  transition: transform 0.25s ease, opacity 0.2s ease, top 0.25s ease;
}

.burger .bars span:nth-child(1) { top: 0; }
.burger .bars span:nth-child(2) { top: 6px; }
.burger .bars span:nth-child(3) { top: 12px; }

.burger[aria-expanded="true"] .bars span:nth-child(1) {
  top: 6px;
  transform: rotate(45deg);
}
.burger[aria-expanded="true"] .bars span:nth-child(2) {
  opacity: 0;
}
.burger[aria-expanded="true"] .bars span:nth-child(3) {
  top: 6px;
  transform: rotate(-45deg);
}

/* Nav panel */
.nav-panel {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  z-index: 30;
  background: var(--paper);
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-panel[data-open="true"] {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.nav-panel ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 3vw, 20px);
  text-align: center;
}

.nav-panel a {
  font-family: var(--font-mono);
  text-decoration: none;
  font-size: clamp(1.6rem, 6vw, 2.6rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
}

.nav-panel a .idx {
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.nav-panel a:hover,
.nav-panel a:focus-visible {
  color: var(--clay);
}

/* ==========================================================================
   Tile grid
   ========================================================================== */
.grid-wrap {
  padding: clamp(20px, 4vw, 40px) clamp(10px, 3vw, 24px) clamp(40px, 6vw, 80px);
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  grid-auto-rows: var(--tile-unit);
  grid-auto-flow: dense;
  gap: var(--gap);
}

.tile {
  position: relative;
  overflow: hidden;
  border-radius: 3px;
  background: var(--paper);
  grid-column: span var(--cs, 1);
  grid-row: span var(--rs, 1);
  border: 1px solid var(--line);
}

.tile--photo {
  cursor: zoom-in;
  padding: 0;
}

.tile--photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--fx, 50%) var(--fy, 50%);
  transition: transform 0.5s ease;
  /* iOS Safari long-press menu (Save/Copy) -- Android has no CSS
     equivalent, see README for why we don't fight that with JS. */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

.tile--photo:hover img,
.tile--photo:focus-visible img {
  transform: scale(1.045);
}

.tile--photo .tag {
  position: absolute;
  left: 8px;
  bottom: 7px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: #fff;
  background: rgba(20, 19, 16, 0.45);
  padding: 2px 6px;
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.tile--photo:hover .tag,
.tile--photo:focus-visible .tag {
  opacity: 1;
}

.tile--photo button {
  all: unset;
  display: block;
  width: 100%;
  height: 100%;
  cursor: zoom-in;
}

/* Anchor tiles (Bio / Foto / Video) */
.tile--anchor {
  --cs: 2;
  --rs: 2;
}

.tile--anchor a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 100%;
  padding: clamp(12px, 2vw, 20px);
  text-decoration: none;
  text-align: center;
  color: var(--tile-ink, #fff);
}

.tile--anchor[data-tone="moss"] { background: var(--moss); --tile-ink: var(--moss-ink); }
.tile--anchor[data-tone="clay"] { background: var(--clay); --tile-ink: var(--clay-ink); }
.tile--anchor[data-tone="slate"] { background: var(--slate); --tile-ink: var(--slate-ink); }

.tile--anchor .idx {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  opacity: 0.75;
}

.tile--anchor .label {
  font-size: clamp(1.1rem, 2.6vw, 1.6rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: lowercase;
}

.tile--anchor .arrow {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  transition: transform 0.2s ease;
}

.tile--anchor a:hover .arrow,
.tile--anchor a:focus-visible .arrow {
  transform: translateX(4px);
}

/* ==========================================================================
   Lightbox
   ========================================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgba(20, 19, 16, 0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: clamp(16px, 5vw, 60px);
}

.lightbox[data-open="true"] {
  opacity: 1;
  pointer-events: auto;
}

.lightbox img {
  max-width: 100%;
  max-height: 82vh;
  width: auto;
  margin: 0 auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox .meta {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: #cfc9bb;
  margin-top: 14px;
}

.lightbox .close {
  all: unset;
  position: absolute;
  top: clamp(12px, 3vw, 28px);
  right: clamp(12px, 3vw, 28px);
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: #f4f1e9;
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
}

.lightbox .close:hover {
  color: var(--clay);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  padding: 22px clamp(16px, 4vw, 40px) 40px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-soft);
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
}

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

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

/* ==========================================================================
   Subpages
   ========================================================================== */
.sub-main {
  max-width: 640px;
  margin: 0 auto;
  padding: clamp(40px, 8vw, 90px) clamp(20px, 5vw, 24px) 80px;
}

.sub-main .idx {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.sub-main h1 {
  font-size: clamp(2rem, 6vw, 3rem);
  margin: 10px 0 24px;
  letter-spacing: -0.02em;
}

.sub-main p {
  line-height: 1.7;
  color: var(--ink-soft);
  font-size: 1.02rem;
}

.sub-main .portrait {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--line);
  margin: 0 0 28px;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

.social-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 34px;
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 3px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 500;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.social-links a:hover,
.social-links a:focus-visible {
  border-color: var(--ink);
  background: var(--paper);
}

.social-links .arrow {
  font-family: var(--font-mono);
  color: var(--ink-soft);
}

.back-link {
  display: inline-block;
  margin-top: 46px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-decoration: none;
  color: var(--ink-soft);
}

.back-link:hover {
  color: var(--ink);
}

.legal-main {
  max-width: 640px;
  margin: 0 auto;
  padding: clamp(40px, 8vw, 90px) clamp(20px, 5vw, 24px) 80px;
  line-height: 1.7;
}

.legal-main h1 {
  font-size: 1.8rem;
  margin-bottom: 20px;
}

.legal-main h2 {
  font-size: 1.05rem;
  margin-top: 34px;
}

/* ==========================================================================
   Mobile breakpoint -- the ONE point where layout is allowed to change.
   Above this, column count is fixed (--cols) so tile positions never
   shift on resize; only --tile-unit (size) changes fluidly.
   ========================================================================== */
@media (max-width: 640px) {
  :root {
    --cols: 2;
    --tile-unit: clamp(120px, 42vw, 220px);
  }

  .tile-grid .tile:not(.tile--anchor) {
    --cs: 1 !important;
    --rs: 1 !important;
  }

  .tile--anchor {
    --cs: 2;
    --rs: 1;
    order: -1;
  }
}
