/* ==========================================================================
   SocialBrew — "field journal for latte art"
   Paper, espresso, pine and a sunrise. Fraunces for voice, Instrument Sans
   for reading, JetBrains Mono for the little stamped labels.
   ========================================================================== */

:root {
  --paper: #F6EFE3;
  --paper-2: #EDE3D1;
  --paper-3: #E3D6C0;
  --card: #FFFCF6;
  --ink: #241A14;
  --ink-2: #5B4A3E;
  --ink-3: #8E7C6E;
  --line: rgba(36, 26, 20, 0.12);
  --line-strong: rgba(36, 26, 20, 0.24);

  --espresso: #2B1D14;
  --crema: #C8945A;
  --ember: #D9712B;
  --ember-2: #B85A1E;
  --gold: #E7B24A;
  --pine: #2E4A3B;
  --pine-2: #1F3329;
  --moss: #5E7A5A;
  --sky: #A9C6D6;
  --lake: #4F7F95;

  --on-ember: #FFF7EC;
  --on-pine: #EFF3EA;

  --shadow-sm: 0 1px 2px rgba(36, 26, 20, 0.06), 0 2px 8px -2px rgba(36, 26, 20, 0.10);
  --shadow: 0 2px 4px rgba(36, 26, 20, 0.06), 0 14px 34px -14px rgba(36, 26, 20, 0.35);
  --shadow-lg: 0 4px 10px rgba(36, 26, 20, 0.08), 0 30px 60px -24px rgba(36, 26, 20, 0.45);

  --r-xs: 8px;
  --r-sm: 12px;
  --r: 18px;
  --r-lg: 26px;
  --r-pill: 999px;

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Instrument Sans", "Helvetica Neue", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --wrap: 1180px;
  --gutter: 20px;
  --nav-h: 68px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --grain-opacity: 0.32;
  --grain-blend: multiply;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #15100D;
    --paper-2: #1D1612;
    --paper-3: #271E18;
    --card: #1F1813;
    --ink: #F2E9DC;
    --ink-2: #CBBBA9;
    --ink-3: #93847A;
    --line: rgba(242, 233, 220, 0.11);
    --line-strong: rgba(242, 233, 220, 0.24);
    --ember: #E8823B;
    --ember-2: #F1A064;
    --crema: #D7A56A;
    --sky: #6E8EA3;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 8px -2px rgba(0, 0, 0, 0.45);
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.35), 0 14px 34px -14px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 4px 10px rgba(0, 0, 0, 0.4), 0 30px 60px -24px rgba(0, 0, 0, 0.8);
    --grain-opacity: 0.22;
    --grain-blend: soft-light;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #15100D;
  --paper-2: #1D1612;
  --paper-3: #271E18;
  --card: #1F1813;
  --ink: #F2E9DC;
  --ink-2: #CBBBA9;
  --ink-3: #93847A;
  --line: rgba(242, 233, 220, 0.11);
  --line-strong: rgba(242, 233, 220, 0.24);
  --ember: #E8823B;
  --ember-2: #F1A064;
  --crema: #D7A56A;
  --sky: #6E8EA3;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 8px -2px rgba(0, 0, 0, 0.45);
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.35), 0 14px 34px -14px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 4px 10px rgba(0, 0, 0, 0.4), 0 30px 60px -24px rgba(0, 0, 0, 0.8);
  --grain-opacity: 0.22;
  --grain-blend: soft-light;
  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
/* paper grain over everything */
body::before {
  content: "";
  position: fixed; inset: -50%;
  width: 200%; height: 200%;
  pointer-events: none;
  z-index: 9999;
  opacity: var(--grain-opacity);
  mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.2 0 0 0 0 0.14 0 0 0 0 0.1 0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 240px 240px;
  animation: grain 1.4s steps(4) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 1%); }
  50% { transform: translate(1%, -2%); }
  75% { transform: translate(-1%, -1%); }
  100% { transform: translate(2%, 2%); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

main { flex: 1 0 auto; }
img, video, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--ember); }
p a, .prose a { color: var(--ember-2); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.015em; line-height: 1.08; margin: 0 0 0.4em; font-variation-settings: "opsz" 72, "SOFT" 50; }
h1 { font-size: clamp(2.3rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
h3 { font-size: 1.35rem; }
em, .em { font-style: italic; font-weight: 400; }
::selection { background: var(--ember); color: var(--on-ember); }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.wrap-narrow { max-width: 760px; }
.mono { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.02em; color: var(--ink-3); }
.eyebrow { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.18em; color: var(--ember-2); display: inline-flex; align-items: center; gap: 8px; }
.eyebrow::before { content: ""; width: 22px; height: 1px; background: currentColor; opacity: 0.7; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ember); color: var(--on-ember); padding: 8px 14px; border-radius: var(--r-pill); z-index: 10001; }
.skip:focus { left: 12px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* --------------------------------------------------------------------------
   Buttons, chips, stickers
   -------------------------------------------------------------------------- */
.btn {
  --bg: var(--paper-2); --fg: var(--ink); --bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 12px 20px; min-height: 44px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--bd);
  background: var(--bg); color: var(--fg);
  font-weight: 600; font-size: 0.95rem; letter-spacing: 0.005em;
  transition: transform .35s var(--ease-spring), box-shadow .3s, background .2s, color .2s, border-color .2s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px) rotate(-0.6deg); color: var(--fg); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn-primary { --bg: var(--ember); --fg: var(--on-ember); box-shadow: 0 10px 24px -12px rgba(217, 113, 43, 0.7); }
.btn-primary:hover { --bg: var(--ember-2); box-shadow: 0 16px 30px -12px rgba(217, 113, 43, 0.75); }
.btn-pine { --bg: var(--pine); --fg: var(--on-pine); }
.btn-pine:hover { --bg: var(--pine-2); }
.btn-ghost { --bg: transparent; --bd: var(--line-strong); }
.btn-ghost:hover { --bg: var(--paper-2); }
.btn-light { --bg: rgba(255, 252, 246, 0.9); --fg: var(--espresso); backdrop-filter: blur(8px); }
.btn-sm { padding: 8px 14px; min-height: 36px; font-size: 0.86rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; pointer-events: none; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: var(--r-pill); background: var(--paper-2); font-size: 0.82rem; font-weight: 600; color: var(--ink-2); border: 1px solid var(--line); }
.chip.is-on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.sticker {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: var(--r-pill);
  background: var(--card); color: var(--ink);
  border: 1.5px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase;
  transform: rotate(var(--tilt, -2deg));
}
.sticker.ember { background: var(--ember); color: var(--on-ember); border-color: var(--espresso); box-shadow: 3px 3px 0 var(--espresso); }
.sticker.pine { background: var(--pine); color: var(--on-pine); border-color: var(--pine-2); box-shadow: 3px 3px 0 var(--pine-2); }

/* --------------------------------------------------------------------------
   Nav
   -------------------------------------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--paper) 72%, transparent);
  backdrop-filter: saturate(1.2) blur(14px);
  -webkit-backdrop-filter: saturate(1.2) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s, background .25s;
}
.nav.scrolled { border-bottom-color: var(--line); background: color-mix(in srgb, var(--paper) 86%, transparent); }
.nav-inner { height: var(--nav-h); display: flex; align-items: center; gap: 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 1.35rem; letter-spacing: -0.02em; font-variation-settings: "opsz" 48, "SOFT" 80; }
.brand:hover { color: var(--ink); }
.brand .brand-mark { width: 34px; height: 34px; color: var(--ember); transition: transform .5s var(--ease-spring); }
.brand:hover .brand-mark { transform: rotate(-12deg) translateY(-1px); }
.brand em { color: var(--ember); font-weight: 400; }
.nav-links { display: flex; align-items: center; gap: 4px; margin-left: 10px; }
.nav-link { padding: 8px 12px; border-radius: var(--r-pill); font-weight: 600; font-size: 0.93rem; color: var(--ink-2); transition: background .2s, color .2s; }
.nav-link:hover, .nav-link.active { background: var(--paper-2); color: var(--ink); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid transparent; background: transparent; color: var(--ink-2); position: relative; transition: background .2s, color .2s, transform .3s var(--ease-spring); }
.icon-btn:hover { background: var(--paper-2); color: var(--ink); transform: translateY(-1px); }
.icon-btn .icon { width: 21px; height: 21px; }
.badge { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--ember); color: var(--on-ember); font-family: var(--font-mono); font-size: 0.66rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--paper); }
.badge[hidden] { display: none; }
.avatar-btn { padding: 0; width: 42px; height: 42px; border-radius: 50%; overflow: hidden; border: 2px solid var(--line-strong); background: var(--paper-2); display: inline-flex; align-items: center; justify-content: center; }
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.theme-toggle .icon-sun, .theme-toggle .icon-moon { position: absolute; transition: transform .5s var(--ease-spring), opacity .3s; }
.theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(0.6); }
:root[data-theme="dark"] .theme-toggle .icon-sun { opacity: 0; transform: rotate(-90deg) scale(0.6); }
:root[data-theme="dark"] .theme-toggle .icon-moon { opacity: 1; transform: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { opacity: 0; transform: rotate(-90deg) scale(0.6); }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { opacity: 1; transform: none; }
}
.burger { display: none; }
@media (max-width: 820px) {
  .nav-links { display: none; }
  .nav.open .nav-links { display: flex; flex-direction: column; align-items: stretch; position: absolute; left: var(--gutter); right: var(--gutter); top: calc(var(--nav-h) + 6px); background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 8px; box-shadow: var(--shadow-lg); margin: 0; }
  .nav.open .nav-links .nav-link { padding: 12px 14px; }
  .burger { display: inline-flex; }
  .nav-right .btn-post .label { display: none; }
  .nav-right .btn-post { padding: 0; width: 42px; }
}

/* --------------------------------------------------------------------------
   Hero (home)
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  min-height: clamp(600px, 88vh, 860px);
  display: grid; align-items: center;
  overflow: hidden;
  margin-top: calc(-1 * var(--nav-h));
  padding-top: var(--nav-h);
  background: linear-gradient(180deg, #F8D9B8 0%, #C9DCE6 55%, #3B5947 100%);
  color: var(--espresso);
  isolation: isolate;
}
:root[data-theme="dark"] .hero { background: linear-gradient(180deg, #1A1428 0%, #3B1F1D 55%, #0C1712 100%); color: #F2E9DC; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero { background: linear-gradient(180deg, #1A1428 0%, #3B1F1D 55%, #0C1712 100%); color: #F2E9DC; } }
#mug-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: 0; transition: opacity 1.2s ease; image-rendering: auto; }
.hero.gl-ready #mug-canvas { opacity: 1; }
.hero.no-gl #mug-canvas { display: none; }
.hero-fallback { position: absolute; inset: 0; z-index: 0; display: none; pointer-events: none; }
.hero.no-gl .hero-fallback { display: block; }
.hero-fallback svg { position: absolute; right: 4%; bottom: 8%; width: min(46vw, 520px); height: auto; opacity: 0.9; }
.hero-shade { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(70% 90% at 18% 55%, rgba(246, 239, 227, 0.78) 0%, rgba(246, 239, 227, 0.45) 35%, rgba(246, 239, 227, 0) 70%); }
:root[data-theme="dark"] .hero-shade { background: radial-gradient(70% 90% at 18% 55%, rgba(21, 16, 13, 0.82) 0%, rgba(21, 16, 13, 0.5) 35%, rgba(21, 16, 13, 0) 70%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero-shade { background: radial-gradient(70% 90% at 18% 55%, rgba(21, 16, 13, 0.82) 0%, rgba(21, 16, 13, 0.5) 35%, rgba(21, 16, 13, 0) 70%); } }
.hero-inner { position: relative; z-index: 2; padding-block: 60px 120px; }
.hero-copy { max-width: 620px; }
.hero-copy .eyebrow { margin-bottom: 18px; color: var(--ember-2); }
:root[data-theme="dark"] .hero-copy .eyebrow { color: var(--gold); }
.hero h1 {
  font-size: clamp(2.9rem, 7.2vw, 6.4rem);
  font-weight: 300; line-height: 0.98; letter-spacing: -0.03em; margin: 0 0 22px;
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
}
.hero h1 em { font-style: italic; font-weight: 500; color: var(--ember); }
.hero p.lede { font-size: clamp(1.05rem, 1.6vw, 1.3rem); line-height: 1.5; max-width: 500px; margin: 0 0 30px; color: inherit; opacity: 0.86; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero-stickers { display: flex; flex-wrap: wrap; gap: 14px 18px; margin-top: 42px; }
.hero-hint { position: absolute; right: var(--gutter); bottom: 30px; z-index: 3; }
.hero-hint .sticker { --tilt: 2deg; }
.scroll-cue { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 2; display: inline-flex; flex-direction: column; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.2em; text-transform: uppercase; opacity: 0.75; }
.scroll-cue .icon { animation: bob 1.8s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
.ridge { position: absolute; left: 0; right: 0; bottom: -2px; z-index: 2; width: 100%; height: auto; pointer-events: none; }
.ridge path { fill: var(--paper); }
@media (max-width: 720px) {
  .hero { min-height: 92vh; align-items: end; }
  .hero-inner { padding-block: 44vh 110px; }
  .hero-shade { background: linear-gradient(180deg, rgba(246, 239, 227, 0) 20%, rgba(246, 239, 227, 0.82) 55%, rgba(246, 239, 227, 0.95) 100%); }
  :root[data-theme="dark"] .hero-shade { background: linear-gradient(180deg, rgba(21, 16, 13, 0) 20%, rgba(21, 16, 13, 0.82) 55%, rgba(21, 16, 13, 0.95) 100%); }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero-shade { background: linear-gradient(180deg, rgba(21, 16, 13, 0) 20%, rgba(21, 16, 13, 0.82) 55%, rgba(21, 16, 13, 0.95) 100%); } }
  .hero-hint, .scroll-cue { display: none; }
  .hero-stickers { margin-top: 26px; }
}

/* --------------------------------------------------------------------------
   Section heads
   -------------------------------------------------------------------------- */
.section { padding-block: 56px 80px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.section-head h2 { margin: 6px 0 0; }
.section-head .sub { color: var(--ink-3); margin: 6px 0 0; max-width: 520px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Feed cards (polaroids pinned to a corkboard that is secretly a grid)
   -------------------------------------------------------------------------- */
.masonry { columns: 3 300px; column-gap: 26px; }
.card {
  break-inside: avoid; -webkit-column-break-inside: avoid; page-break-inside: avoid;
  display: inline-block; width: 100%;
  margin: 0 0 26px;
  background: var(--card);
  border-radius: var(--r);
  padding: 10px 10px 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  transform: rotate(var(--rot, 0deg));
  transition: transform .5s var(--ease-out), box-shadow .35s;
  animation: rise .8s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 70ms);
  position: relative;
}
@keyframes rise { from { opacity: 0; transform: translateY(22px) rotate(var(--rot, 0deg)); } to { opacity: 1; transform: translateY(0) rotate(var(--rot, 0deg)); } }
.card:nth-child(3n+1) { --rot: -0.7deg; }
.card:nth-child(3n+2) { --rot: 0.5deg; }
.card:nth-child(3n+3) { --rot: -0.3deg; }
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px) rotate(0deg); z-index: 2; }
.card-media { display: block; position: relative; overflow: hidden; border-radius: calc(var(--r) - 6px); background: var(--paper-2); aspect-ratio: var(--ar, auto); }
.card-media img, .card-media video { width: 100%; height: auto; display: block; transition: transform .9s var(--ease-out), filter .5s; filter: saturate(1.02) contrast(1.02); }
.card:hover .card-media img, .card:hover .card-media video { transform: scale(1.035); }
.card-media .badge-video { position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--r-pill); background: rgba(36, 26, 20, 0.7); color: #fff; font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; backdrop-filter: blur(6px); }
.card-body { padding: 12px 6px 0; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.author { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; font-size: 0.93rem; min-width: 0; }
.author:hover { color: var(--ember); }
.author-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; background: var(--paper-2); border: 1.5px solid var(--line); }
.avatar-ph { display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 600; font-size: 0.9rem; color: var(--on-ember); background: linear-gradient(135deg, var(--ember), var(--crema)); border: none; }
.card-caption { margin: 10px 0 0; color: var(--ink-2); font-size: 0.95rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-actions { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }

/* like button */
.upvote-btn, .comment-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: var(--r-pill);
  border: 1px solid transparent; background: transparent; color: var(--ink-2);
  font-weight: 600; font-size: 0.9rem; font-variant-numeric: tabular-nums;
  transition: background .2s, color .2s, border-color .2s;
}
.upvote-btn:hover, .comment-btn:hover { background: var(--paper-2); color: var(--ink); }
.upvote-btn .icon { width: 19px; height: 19px; transition: transform .35s var(--ease-spring), fill .2s, stroke .2s; }
.upvote-btn.upvoted { color: var(--ember); }
.upvote-btn.upvoted .icon { fill: var(--ember); stroke: var(--ember); }
.upvote-btn.pop .icon { animation: heart-pop .55s var(--ease-spring); }
.upvote-btn.pop::after { content: ""; position: absolute; width: 8px; height: 8px; border-radius: 50%; left: 18px; top: 50%; box-shadow: 0 -16px 0 -2px var(--ember), 12px -10px 0 -2px var(--gold), 14px 6px 0 -2px var(--ember), -12px -10px 0 -2px var(--gold), -14px 6px 0 -2px var(--ember), 0 16px 0 -2px var(--gold); animation: burst .6s ease-out forwards; pointer-events: none; }
.upvote-btn { position: relative; }
@keyframes heart-pop { 0% { transform: scale(1); } 30% { transform: scale(1.45) rotate(-8deg); } 100% { transform: scale(1); } }
@keyframes burst { 0% { transform: translateY(-50%) scale(0.3); opacity: 1; } 100% { transform: translateY(-50%) scale(1.6); opacity: 0; } }
.comment-btn .icon { width: 18px; height: 18px; }

.scroll-sentinel { display: flex; justify-content: center; padding: 30px 0; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--ember); animation: spin 0.9s linear infinite; opacity: 0.4; transition: opacity .2s; }
.scroll-sentinel.busy .spinner { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
.end-of-feed { text-align: center; padding: 40px 0 10px; color: var(--ink-3); font-family: var(--font-display); font-style: italic; font-size: 1.25rem; }
.end-of-feed[hidden] { display: none; }
.end-of-feed .mono { display: block; margin-top: 6px; }

.empty { text-align: center; padding: 70px 20px; background: var(--card); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); }
.empty .big { font-size: 3rem; line-height: 1; margin-bottom: 14px; }
.empty h2 { margin-bottom: 8px; }
.empty p { color: var(--ink-3); margin: 0 0 22px; }

/* --------------------------------------------------------------------------
   Latte detail
   -------------------------------------------------------------------------- */
.detail { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.85fr); gap: 36px; align-items: start; padding-block: 34px 80px; }
.detail-media { position: sticky; top: calc(var(--nav-h) + 20px); background: var(--card); padding: 12px; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); border: 1px solid var(--line); transform: rotate(-0.6deg); }
.detail-media img, .detail-media video { width: 100%; height: auto; border-radius: calc(var(--r-lg) - 8px); cursor: zoom-in; background: var(--paper-2); }
.detail-media video { cursor: default; }
.detail-media .mono { display: flex; justify-content: space-between; padding: 12px 6px 2px; }
.detail-side { display: flex; flex-direction: column; gap: 22px; }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.detail-head .author { font-size: 1.05rem; }
.detail-head .avatar { width: 44px; height: 44px; }
.detail-caption { font-family: var(--font-display); font-size: clamp(1.25rem, 2vw, 1.6rem); line-height: 1.35; font-weight: 400; font-variation-settings: "opsz" 36, "SOFT" 60; margin: 0; }
.detail-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-actions .upvote-btn, .detail-actions .comment-btn { padding: 10px 16px; border: 1px solid var(--line); background: var(--card); font-size: 0.95rem; }
.btn-danger { --bg: transparent; --fg: #B23A2E; --bd: rgba(178, 58, 46, 0.35); }
.btn-danger:hover { --bg: rgba(178, 58, 46, 0.1); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow-sm); }
.panel h3 { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.panel h3 .mono { font-size: 0.72rem; }
.comment-form { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 18px; }
.comment-form textarea { flex: 1; resize: none; min-height: 46px; }
.comments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.comment { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--paper); border: 1px solid var(--line); }
.comment.is-new { animation: slide-in .5s var(--ease-out); }
@keyframes slide-in { from { opacity: 0; transform: translateY(8px); } }
.comment-author { font-weight: 700; font-size: 0.9rem; }
.comment-text { grid-column: 1 / -1; margin: 0; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-date { grid-column: 2; grid-row: 1; }
.no-comments { color: var(--ink-3); font-style: italic; font-family: var(--font-display); margin: 0; }
.login-prompt { color: var(--ink-3); margin: 0 0 16px; }
@media (max-width: 900px) {
  .detail { grid-template-columns: 1fr; gap: 24px; padding-top: 18px; }
  .detail-media { position: static; transform: none; }
}

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 10000; background: rgba(20, 14, 10, 0.92); display: none; align-items: center; justify-content: center; padding: 20px; cursor: zoom-out; backdrop-filter: blur(6px); }
.lightbox.open { display: flex; animation: fade .25s ease; }
.lightbox img { max-width: 100%; max-height: 100%; width: auto; height: auto; border-radius: var(--r-sm); box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.8); }
.lightbox-close { position: absolute; top: 14px; right: 18px; width: 44px; height: 44px; border-radius: 50%; border: none; background: rgba(255, 255, 255, 0.12); color: #fff; font-size: 1.6rem; line-height: 1; }
@keyframes fade { from { opacity: 0; } }

/* --------------------------------------------------------------------------
   Profile
   -------------------------------------------------------------------------- */
.profile-hero { padding-block: 40px 30px; display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
.avatar-xl { width: 128px; height: 128px; border-radius: 50%; object-fit: cover; border: 4px solid var(--card); box-shadow: var(--shadow), 0 0 0 2px var(--line); background: var(--paper-2); }
.avatar-xl.avatar-ph { font-size: 3rem; }
.profile-info h1 { margin-bottom: 6px; }
.profile-info .bio { color: var(--ink-2); max-width: 60ch; margin: 0 0 14px; font-size: 1.05rem; }
.stats { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 16px; }
.stat { display: flex; flex-direction: column; }
.stat b { font-family: var(--font-display); font-size: 1.6rem; font-weight: 500; line-height: 1; }
.stat span { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); margin-top: 4px; }
.profile-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; padding-bottom: 80px; }
.tile { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: var(--r-sm); background: var(--paper-2); box-shadow: var(--shadow-sm); transition: box-shadow .3s; animation: tile-in .6s var(--ease-out) both; }
@keyframes tile-in { from { opacity: 0; transform: scale(0.96); } }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease-out); }
.tile:hover img, .tile:hover video { transform: scale(1.06); }
.tile:hover { box-shadow: var(--shadow); }
.tile-overlay { position: absolute; inset: auto 0 0 0; padding: 26px 12px 10px; display: flex; gap: 14px; color: #fff; font-weight: 700; font-size: 0.9rem; background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(36, 26, 20, 0.7) 100%); opacity: 0; transition: opacity .25s; }
.tile:hover .tile-overlay, .tile:focus-visible .tile-overlay { opacity: 1; }
.tile-overlay span { display: inline-flex; align-items: center; gap: 5px; }
.tile-overlay .icon { width: 16px; height: 16px; fill: #fff; stroke: #fff; }
@media (max-width: 640px) {
  .profile-hero { grid-template-columns: 1fr; text-align: center; justify-items: center; gap: 16px; }
  .stats, .profile-actions { justify-content: center; }
  .gallery { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .tile { border-radius: 6px; }
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-page { padding-block: 40px 90px; }
.form-card { max-width: 620px; margin-inline: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(22px, 4vw, 40px); box-shadow: var(--shadow); }
.form-card > .eyebrow { margin-bottom: 10px; }
.form-card h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.form-card .sub { color: var(--ink-3); margin: -6px 0 26px; }
.field { margin-bottom: 18px; }
.field label, .label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 7px; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="search"], textarea, select {
  width: 100%; padding: 13px 15px; border-radius: var(--r-sm);
  border: 1.5px solid var(--line-strong); background: var(--paper); color: var(--ink);
  font: inherit; font-size: 1rem; line-height: 1.4;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
textarea { resize: vertical; min-height: 110px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--ember); box-shadow: 0 0 0 4px rgba(217, 113, 43, 0.18); background: var(--card); }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input[type="file"] { width: 100%; padding: 10px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-sm); background: var(--paper); font-size: 0.9rem; }
.help { display: block; margin-top: 6px; color: var(--ink-3); font-size: 0.82rem; }
.help ul { margin: 4px 0 0; padding-left: 18px; }
.errors { margin-top: 7px; color: #B23A2E; font-size: 0.86rem; }
.errors span, .errors p { display: block; margin: 2px 0; }
.alert { padding: 13px 16px; border-radius: var(--r-sm); margin-bottom: 18px; font-size: 0.95rem; border: 1px solid; }
.alert-error { background: rgba(178, 58, 46, 0.08); border-color: rgba(178, 58, 46, 0.3); color: #8E2E24; }
.alert-ok { background: rgba(94, 122, 90, 0.14); border-color: rgba(94, 122, 90, 0.4); color: var(--pine); }
:root[data-theme="dark"] .alert-error { color: #F0A59B; }
:root[data-theme="dark"] .alert-ok { color: #B9D6B2; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 26px; }
.form-foot { text-align: center; margin-top: 22px; color: var(--ink-3); font-size: 0.95rem; }

/* upload dropzone */
.dropzone { position: relative; border: 2px dashed var(--line-strong); border-radius: var(--r); background: var(--paper); padding: 30px 20px; text-align: center; transition: border-color .2s, background .2s, transform .2s; min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; overflow: hidden; }
.dropzone.drag { border-color: var(--ember); background: rgba(217, 113, 43, 0.06); transform: scale(1.01); }
.dropzone .dz-icon { width: 54px; height: 54px; color: var(--ember); }
.dropzone .dz-title { font-family: var(--font-display); font-size: 1.3rem; }
.dropzone .dz-sub { color: var(--ink-3); font-size: 0.9rem; margin: 0; }
.dropzone.has-preview { padding: 0; border-style: solid; border-color: var(--line); background: var(--espresso); }
.dropzone .preview { width: 100%; max-height: 480px; object-fit: contain; display: block; }
.dropzone .dz-clear { position: absolute; top: 10px; right: 10px; }
.dropzone .dz-error { color: #B23A2E; font-weight: 600; }
.upload-options { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }

/* --------------------------------------------------------------------------
   Auth (split poster + form)
   -------------------------------------------------------------------------- */
.auth { display: grid; grid-template-columns: 1fr 1fr; min-height: calc(100dvh - var(--nav-h)); }
.auth-poster {
  position: relative; overflow: hidden; padding: 48px;
  display: flex; flex-direction: column; justify-content: space-between;
  color: #F6EFE3;
  background:
    radial-gradient(60% 40% at 70% 20%, rgba(231, 178, 74, 0.55) 0%, rgba(231, 178, 74, 0) 70%),
    linear-gradient(180deg, #E9B98F 0%, #B7B9A8 35%, #3C5A47 70%, #1F3329 100%);
}
.auth-poster .ridge-art { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: auto; }
.auth-poster .poster-brand { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.3rem; color: #FFF7EC; }
.auth-poster .poster-brand svg { width: 32px; height: 32px; color: #FFF7EC; }
.auth-poster blockquote { position: relative; z-index: 1; margin: 0; font-family: var(--font-display); font-weight: 300; font-size: clamp(1.8rem, 3.2vw, 2.8rem); line-height: 1.15; letter-spacing: -0.02em; font-variation-settings: "opsz" 96, "SOFT" 100; max-width: 15ch; text-wrap: balance; }
.auth-poster blockquote em { color: var(--gold); }
.auth-poster footer { position: relative; z-index: 1; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.85; }
.auth-form-col { display: flex; align-items: center; justify-content: center; padding: 40px var(--gutter) 80px; }
.auth-form-col .form-card { width: 100%; max-width: 440px; box-shadow: none; border: none; background: transparent; padding: 0; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; min-height: 0; }
  .auth-poster { min-height: 260px; padding: 28px var(--gutter); }
  .auth-poster blockquote { font-size: 1.6rem; max-width: 20ch; }
}

/* --------------------------------------------------------------------------
   Notifications
   -------------------------------------------------------------------------- */
.notif-list { display: flex; flex-direction: column; gap: 10px; padding-bottom: 80px; }
.notif { display: grid; grid-template-columns: 44px 1fr 64px; gap: 14px; align-items: center; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); transition: transform .3s var(--ease-out), box-shadow .3s; }
.notif:hover { transform: translateX(4px); box-shadow: var(--shadow); color: inherit; }
.notif.unread { border-left: 4px solid var(--ember); }
.notif-icon { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--paper-2); color: var(--ember); }
.notif-icon .icon { width: 20px; height: 20px; }
.notif-icon.like .icon { fill: var(--ember); }
.notif-icon.comment { color: var(--lake); }
.notif-text { margin: 0; line-height: 1.4; }
.notif-text q { font-style: italic; color: var(--ink-2); }
.notif-thumb { width: 64px; height: 64px; border-radius: var(--r-xs); object-fit: cover; background: var(--paper-2); }

/* --------------------------------------------------------------------------
   Feedback
   -------------------------------------------------------------------------- */
.fb-layout { display: grid; grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.3fr); gap: 34px; align-items: start; padding-block: 34px 90px; }
.fb-sticky { position: sticky; top: calc(var(--nav-h) + 20px); }
.fb-list { display: flex; flex-direction: column; gap: 14px; }
.fb-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow-sm); position: relative; }
.fb-item.addressed { background: color-mix(in srgb, var(--card) 85%, var(--moss)); }
.fb-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.fb-meta b { font-size: 0.95rem; }
.status { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; padding: 4px 9px; border-radius: var(--r-pill); }
.status.pending { background: rgba(231, 178, 74, 0.25); color: #7A5410; }
.status.done { background: rgba(94, 122, 90, 0.25); color: var(--pine); }
:root[data-theme="dark"] .status.pending { color: var(--gold); }
:root[data-theme="dark"] .status.done { color: #B9D6B2; }
.fb-body { margin: 0; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 860px) { .fb-layout { grid-template-columns: 1fr; } .fb-sticky { position: static; } }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.footer { position: relative; margin-top: auto; background: var(--pine-2); color: var(--on-pine); }
.footer .ridge-top { display: block; width: 100%; height: auto; margin-bottom: -1px; }
.footer .ridge-top path { fill: var(--pine-2); }
.footer-inner { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 30px; padding: 20px var(--gutter) 40px; }
.footer .brand { color: var(--on-pine); }
.footer .brand .brand-mark { color: var(--gold); }
.footer p { color: rgba(239, 243, 234, 0.72); max-width: 36ch; margin: 10px 0 0; }
.footer h4 { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); margin: 6px 0 12px; }
.footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.footer a:hover { color: var(--gold); }
.footer-bottom { border-top: 1px solid rgba(239, 243, 234, 0.12); padding: 16px var(--gutter) 22px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; color: rgba(239, 243, 234, 0.6); }
@media (max-width: 720px) { .footer-inner { grid-template-columns: 1fr 1fr; } .footer-inner > :first-child { grid-column: 1 / -1; } }

/* --------------------------------------------------------------------------
   Misc
   -------------------------------------------------------------------------- */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); z-index: 10002; background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: var(--r-pill); font-weight: 600; font-size: 0.92rem; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .25s, transform .35s var(--ease-out); }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast a { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
.messages { padding-top: 16px; }
.message { padding: 12px 16px; border-radius: var(--r-sm); background: var(--card); border: 1px solid var(--line); margin-bottom: 8px; }
.page-head { padding-block: 44px 10px; }
.page-head h1 { margin-bottom: 4px; }
.page-head .sub { color: var(--ink-3); margin: 0; }
