/* ==========================================================================
   projects.mikesego.com — a warm, crafted gallery of small joyful things
   ========================================================================== */

:root {
  --bg:        #f5f1e8;   /* warm paper */
  --bg-2:      #efe9dc;
  --ink:       #201d19;
  --ink-soft:  #6b655c;
  --ink-faint: #8a8377;   /* solid — decorative use only */
  --card:      #fffdf8;
  --line:      #e5ddcd;
  --brand:     #17b5a1;   /* deeper teal for text/contrast */
  --brand-lt:  #51d8c5;   /* mikesego.com accent */
  --brand-ink: #0d7c6f;
  --shadow:    18px 30px 60px -30px rgba(40, 34, 24, 0.35);
  --maxw:      1180px;
  --r:         20px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; }

.wrap { width: min(100% - 44px, var(--maxw)); margin-inline: auto; }
.nowrap { white-space: nowrap; }

/* ---------- ambient animated background ---------------------------------- */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(1200px 700px at 82% -10%, #ffffff 0%, transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
.ambient::after { /* faint dotted grid */
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(32, 29, 25, 0.05) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 78%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 78%);
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  will-change: transform;
}
.blob-1 { width: 520px; height: 520px; top: -160px; right: -80px;
  background: radial-gradient(circle at 30% 30%, #7ee8da, #51d8c5); animation: drift1 26s ease-in-out infinite; }
.blob-2 { width: 460px; height: 460px; top: 120px; left: -140px;
  background: radial-gradient(circle at 30% 30%, #ffd7a8, #ffb26b); opacity: 0.4; animation: drift2 32s ease-in-out infinite; }
.blob-3 { width: 380px; height: 380px; top: 380px; right: 8%;
  background: radial-gradient(circle at 30% 30%, #ffc0d8, #ff9ec2); opacity: 0.32; animation: drift3 38s ease-in-out infinite; }
@keyframes drift1 { 50% { transform: translate(-60px, 60px) scale(1.08); } }
@keyframes drift2 { 50% { transform: translate(70px, -40px) scale(1.1); } }
@keyframes drift3 { 50% { transform: translate(-40px, -50px) scale(0.94); } }

.emoji-field { position: absolute; inset: 0; }
.emoji-field span {
  position: absolute;
  font-size: var(--sz, 30px);
  opacity: 0.16;
  filter: saturate(1.1);
  animation: floaty var(--dur, 22s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  will-change: transform;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-26px) rotate(8deg); }
}

/* ---------- hero --------------------------------------------------------- */
.hero {
  position: relative;
  padding: clamp(64px, 12vh, 130px) 0 clamp(34px, 6vh, 60px);
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: rgba(255, 253, 248, 0.7);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: border-color 0.2s, color 0.2s, transform 0.2s;
}
.eyebrow:hover { color: var(--ink); border-color: var(--brand-lt); transform: translateY(-1px); }
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-lt);
  box-shadow: 0 0 0 4px rgba(81, 216, 197, 0.25); }
.eyebrow .sep { opacity: 0.4; }

.hero-title {
  font-family: "Fraunces", Georgia, serif;
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: clamp(2.4rem, 6.2vw, 5rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 22px 0 0;
  max-width: 15ch;
}
.hero-title .hl { color: var(--brand-ink); font-style: italic; font-weight: 500; }
.hero-title .hl-2 { color: #b3620f; }

.hero-intro {
  margin: 26px 0 0;
  max-width: 60ch;
  font-size: clamp(1.02rem, 1.4vw, 1.2rem);
  color: var(--ink-soft);
}
.hero-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.chip-stat {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 500;
  padding: 8px 15px;
  border-radius: 100px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px -4px rgba(40, 34, 24, 0.15);
}
.chip-stat b { color: var(--brand-ink); font-weight: 700; }

.scroll-cue { display: flex; justify-content: center; margin-top: clamp(20px, 4vh, 44px); }
.scroll-cue span {
  width: 22px; height: 34px; border: 2px solid var(--ink-faint); border-radius: 12px; position: relative;
}
.scroll-cue span::after {
  content: ""; position: absolute; left: 50%; top: 6px; width: 3px; height: 7px; border-radius: 2px;
  background: var(--ink-soft); transform: translateX(-50%); animation: cue 1.8s ease-in-out infinite;
}
@keyframes cue { 0% { opacity: 0; transform: translate(-50%, 0); } 40% { opacity: 1; } 80% { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------- filters (sticky) -------------------------------------------- */
.filters {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: center;
  padding: 14px 22px;
  margin-bottom: 8px;
  background: rgba(245, 241, 232, 0.82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.filters.stuck { border-color: var(--line); box-shadow: 0 6px 20px -16px rgba(40, 34, 24, 0.5); }
.filter {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.filter:hover { color: var(--ink); border-color: var(--brand-lt); transform: translateY(-1px); }
.filter .n { opacity: 0.5; font-weight: 500; margin-left: 3px; }
.filter[aria-pressed="true"] {
  color: #04302b;
  background: var(--brand-lt);
  border-color: var(--brand-lt);
  box-shadow: 0 6px 16px -8px rgba(81, 216, 197, 0.9);
}
.filter[aria-pressed="true"] .n { opacity: 0.7; }

/* filter list wrapper + mobile hamburger menu */
.filter-list { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; }
.filter-toggle { display: none; }

@media (max-width: 660px) {
  .filters { padding: 10px 12px; }
  .filter-toggle {
    display: flex; align-items: center; gap: 9px; width: 100%;
    font-family: inherit; font-size: 14.5px; font-weight: 600; color: var(--ink);
    background: var(--card); border: 1px solid var(--line); border-radius: 100px;
    padding: 12px 18px; cursor: pointer;
    box-shadow: 0 2px 10px -6px rgba(40, 34, 24, 0.3);
  }
  .filter-toggle .ft-icon { color: var(--brand-ink); font-size: 16px; }
  .filter-toggle .ft-current {
    margin-left: auto; color: var(--ink-soft); font-weight: 600;
    max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .filter-toggle .ft-chev { color: var(--ink-soft); transition: transform 0.2s; }
  .filters.open .filter-toggle .ft-chev { transform: rotate(180deg); }

  .filter-list { display: none; }
  .filters.open .filter-list {
    display: flex; flex-direction: column; gap: 6px; align-items: stretch;
    position: absolute; top: calc(100% - 4px); left: 12px; right: 12px;
    background: var(--card); border: 1px solid var(--line); border-radius: 16px;
    padding: 8px; box-shadow: var(--shadow); z-index: 30;
    max-height: 62vh; overflow-y: auto;
  }
  .filters.open .filter-list .filter { width: 100%; text-align: left; }
}

/* ---------- grid --------------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-flow: row dense;
  grid-auto-rows: 8px;      /* masonry base unit — row spans set by app.js */
  column-gap: 26px;
  row-gap: 0;               /* vertical rhythm comes from the span reservation */
  align-items: start;
  padding: 26px 0 70px;
}
/* fallback if JS masonry hasn't run yet (also the no-JS layout) */
.grid.no-masonry { grid-auto-rows: auto; row-gap: 26px; }
@media (max-width: 1080px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 660px)  { .grid { grid-template-columns: 1fr; } }

/* ---------- card --------------------------------------------------------- */
.card {
  --tint: color-mix(in srgb, var(--accent) 12%, var(--card));
  position: relative;
  align-self: start; /* natural height — organic masonry, no stretch gaps */
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 6px 20px -16px rgba(40, 34, 24, 0.5);
  transition: transform 0.28s cubic-bezier(.2,.7,.2,1), box-shadow 0.28s, border-color 0.28s;
  /* reveal */
  opacity: 0;
  transform: translateY(26px);
}
.card.in { opacity: 1; transform: none; }
.card::before { /* accent top hairline */
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 40%, #fff));
  z-index: 3;
}
.card:hover {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 26px 50px -28px color-mix(in srgb, var(--accent) 60%, rgba(40,34,24,.6));
}

.shot {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--tint);
  border-bottom: 1px solid var(--line);
}
.shot img {
  width: 100%; height: 100%; object-fit: cover; object-position: top center;
  display: block;
  transition: transform 0.5s cubic-bezier(.2,.7,.2,1);
}
.card:hover .shot img { transform: scale(1.045); }
.shot::after { /* subtle bottom fade for legibility of chips */
  content: ""; position: absolute; inset: auto 0 0 0; height: 40%;
  background: linear-gradient(transparent, rgba(20,16,10,0.12));
}
.badge-featured {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: #04302b;
  background: rgba(255, 255, 255, 0.92);
  padding: 5px 11px; border-radius: 100px;
  box-shadow: 0 4px 12px -6px rgba(0,0,0,0.4);
  display: inline-flex; align-items: center; gap: 5px;
}

.body { padding: 20px 21px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card-top { display: flex; align-items: center; gap: 10px; }
.emoji {
  font-size: 22px; line-height: 1;
  width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--tint); border-radius: 12px; flex: none;
}
.cat {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: #574f45;
  color: color-mix(in srgb, var(--accent) 58%, #2b2620);
}
.card h3 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1.42rem;
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 2px 0 0;
}
.card .tag {
  font-weight: 600;
  font-size: 0.98rem;
  color: #4a4038;
  color: color-mix(in srgb, var(--accent) 64%, #241f18);
  margin: -2px 0 2px;
}
.card .desc {
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin: 0;
}
.tech { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.tech span {
  font-size: 11.5px; font-weight: 500; color: var(--ink-soft);
  background: var(--bg-2); border: 1px solid var(--line);
  padding: 3px 9px; border-radius: 7px;
}
.visit {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 4px;
  font-size: 13.5px; font-weight: 700; letter-spacing: 0.01em;
  color: #40382f;
  color: color-mix(in srgb, var(--accent) 68%, #1c1a16);
}
.visit .arrow { transition: transform 0.2s; }
.card:hover .visit .arrow { transform: translate(3px, -3px); }
.visit .host { color: var(--ink-soft); font-weight: 500; }

/* featured: span two columns (row span computed by the masonry layout) */
.card.feat { grid-column: span 2; }
.card.feat .shot { aspect-ratio: 16 / 8.4; }
.card.feat h3 { font-size: 1.9rem; }
.card.feat .tag { font-size: 1.08rem; }
.card.feat .desc { font-size: 1rem; }
@media (min-width: 661px) and (max-width: 1080px) {
  .card.feat { grid-column: span 2; }
}
@media (max-width: 660px) {
  .card.feat { grid-column: span 1; }
  .card.feat h3 { font-size: 1.5rem; }
}

.empty { text-align: center; color: var(--ink-soft); padding: 40px 0 80px; }

/* ---------- footer ------------------------------------------------------- */
.foot {
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, transparent, rgba(255,253,248,0.6));
  padding: 46px 0 60px;
  text-align: center;
}
.foot-lead { font-size: 1.05rem; margin: 0 auto; max-width: 44ch; }
.foot-links { display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; margin: 20px 0 0; }
.foot-links a {
  font-size: 13px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-soft); text-decoration: none; transition: color 0.18s;
}
.foot-links a:hover { color: var(--brand-ink); }
.foot-fine { font-size: 13px; color: var(--ink-soft); margin: 22px 0 0; }
.foot-fine a { color: var(--ink-soft); }

/* ---------- accessibility helpers --------------------------------------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 3px solid var(--brand-ink); outline-offset: 3px; }
.filter:focus-visible, .card:focus-visible, .eyebrow:focus-visible,
.foot-links a:focus-visible, .foot-fine a:focus-visible {
  outline: 3px solid var(--brand-ink);
  outline-offset: 3px;
  border-radius: 12px;
}
.card:focus-visible { border-radius: var(--r); }

/* ---------- motion preferences ------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto !important; }
  .card { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}
