/* =========================================================================
   josepharari.com — landing
   Apple-flavored, light-primary. SF system font, soft depth, generous air.
   ========================================================================= */

:root {
  /* Type */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "Segoe UI", system-ui, Roboto, Helvetica, Arial, sans-serif;

  /* Radii */
  --r-card: 24px;
  --r-tile: 18px;
  --r-pill: 980px;
  --r-glyph: 22px;

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.5, 1);

  /* Accent (tweakable) */
  --accent: #0071e3;
  --accent-text: #ffffff;

  /* Density (tweakable) — overridden by [data-density] */
  --grid-min: 320px;
  --grid-gap: 22px;
}

/* ---------- Light theme (primary) ---------- */
html[data-theme="light"] {
  --bg: #f5f5f7;
  --bg-2: #ececee;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --surface-sunk: #f2f2f4;
  --text: #1d1d1f;
  --text-2: #515154;
  --text-3: #86868b;
  --hairline: rgba(0, 0, 0, 0.08);
  --hairline-strong: rgba(0, 0, 0, 0.14);
  --shadow-rest: 0 1px 2px rgba(0,0,0,0.04), 0 6px 16px rgba(0,0,0,0.05);
  --shadow-hover: 0 2px 6px rgba(0,0,0,0.06), 0 18px 44px rgba(0,0,0,0.12);
  --shadow-modal: 0 40px 120px rgba(0,0,0,0.30), 0 8px 24px rgba(0,0,0,0.18);
  --topbar-bg: rgba(245, 245, 247, 0.72);
  --skel-a: #ececee;
  --skel-b: #f6f6f8;
  --scrim: rgba(0, 0, 0, 0.32);
}

/* ---------- Dark theme ---------- */
html[data-theme="dark"] {
  --bg: #000000;
  --bg-2: #0a0a0c;
  --surface: #1c1c1e;
  --surface-2: #242427;
  --surface-sunk: #161618;
  --text: #f5f5f7;
  --text-2: #c7c7cc;
  --text-3: #8e8e93;
  --hairline: rgba(255, 255, 255, 0.10);
  --hairline-strong: rgba(255, 255, 255, 0.18);
  --shadow-rest: 0 1px 2px rgba(0,0,0,0.5), 0 6px 18px rgba(0,0,0,0.45);
  --shadow-hover: 0 2px 8px rgba(0,0,0,0.55), 0 22px 50px rgba(0,0,0,0.6);
  --shadow-modal: 0 40px 120px rgba(0,0,0,0.7), 0 8px 24px rgba(0,0,0,0.5);
  --topbar-bg: rgba(10, 10, 12, 0.72);
  --skel-a: #232325;
  --skel-b: #2c2c2f;
  --scrim: rgba(0, 0, 0, 0.55);
}

/* ---------- Reset / base ---------- */
* , *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ---------- Shell ---------- */
.shell { max-width: 1180px; margin: 0 auto; padding: 0 24px 120px; }
@media (min-width: 1280px) { .shell { max-width: 1240px; } }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: var(--topbar-bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background-color 0.4s var(--ease);
}
.topbar.scrolled { border-bottom-color: var(--hairline); }
.topbar-inner {
  max-width: 1180px; margin: 0 auto;
  height: 54px; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.wordmark { display: flex; align-items: center; gap: 11px; font-weight: 600; font-size: 15px; letter-spacing: -0.02em; }
.wordmark .mono {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700; letter-spacing: 0; color: #fff;
  background: linear-gradient(135deg, #2b6cf6, #6f4cf0);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.4), 0 1px 3px rgba(0,0,0,0.18);
}
.wordmark .mono img { width: 100%; height: 100%; object-fit: cover; border-radius: 9px; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }

.iconbtn {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2);
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
}
.iconbtn:hover { background: var(--surface-sunk); color: var(--text); }
.iconbtn:active { transform: scale(0.92); }
.iconbtn svg { width: 18px; height: 18px; }

/* ---------- Settings popover ---------- */
.pop-wrap { position: relative; }
.popover {
  position: absolute; top: calc(100% + 10px); right: 0; width: 264px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 18px; box-shadow: var(--shadow-hover);
  padding: 14px; z-index: 60;
  opacity: 0; transform: translateY(-6px) scale(0.98); transform-origin: top right;
  pointer-events: none; transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.popover.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.pop-section + .pop-section { margin-top: 14px; }
.pop-label { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); margin: 0 2px 8px; }
.seg { display: flex; background: var(--surface-sunk); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button {
  flex: 1; padding: 7px 4px; border-radius: 8px; font-size: 12.5px; font-weight: 500;
  color: var(--text-2); transition: all 0.18s var(--ease);
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-rest); }
.swatches { display: flex; gap: 9px; padding: 2px; }
.swatch {
  width: 26px; height: 26px; border-radius: 50%; position: relative;
  transition: transform 0.18s var(--ease-spring);
}
.swatch:hover { transform: scale(1.12); }
.swatch[aria-pressed="true"]::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--text); 
}

/* ---------- Hero ---------- */
.hero { padding: 64px 0 40px; }
@media (min-width: 768px) { .hero { padding: 88px 0 52px; } }
.hero .eyebrow {
  font-size: 13px; font-weight: 600; letter-spacing: 0.02em; color: var(--accent);
  margin: 0 0 18px;
}
.hero h1 {
  margin: 0 0 22px; font-weight: 600;
  font-size: clamp(38px, 6vw, 68px); line-height: 1.04; letter-spacing: -0.035em;
  max-width: 16ch; text-wrap: balance;
}
.hero h1 .soft { color: var(--text-3); }
.hero .lede {
  margin: 0; font-size: clamp(17px, 1.8vw, 21px); line-height: 1.5;
  color: var(--text-2); max-width: 58ch; font-weight: 400; text-wrap: pretty;
}
.hero-meta { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 28px; align-items: center; }
.hero-meta a {
  display: inline-flex; align-items: center; gap: 7px; font-size: 14.5px; font-weight: 500;
  color: var(--accent);
}
.hero-meta a svg { width: 15px; height: 15px; }
.hero-meta a .arrow { transition: transform 0.2s var(--ease); }
.hero-meta a:hover .arrow { transform: translateX(3px); }
.hero-meta .dotsep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); }

/* ---------- Controls row ---------- */
.controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  padding: 14px 0 30px; position: sticky; top: 54px; z-index: 30;
  background: linear-gradient(var(--bg) 72%, transparent);
}
.search { position: relative; flex: 0 1 300px; }
.search svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-3); pointer-events: none;
}
.search input {
  width: 100%; height: 40px; padding: 0 14px 0 40px;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-pill);
  font-size: 14.5px; outline: none; box-shadow: var(--shadow-rest);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.search input::placeholder { color: var(--text-3); }
.search input:focus { border-color: color-mix(in srgb, var(--accent) 55%, var(--hairline)); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 auto; }
.chip {
  padding: 8px 15px; border-radius: var(--r-pill); font-size: 13.5px; font-weight: 500;
  color: var(--text-2); background: var(--surface); border: 1px solid var(--hairline);
  white-space: nowrap; transition: all 0.18s var(--ease);
}
.chip:hover { color: var(--text); transform: translateY(-1px); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- Section headings ---------- */
.section { margin-bottom: 44px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin: 0 0 18px; padding: 0 2px; }
.section-head h2 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.section-head .n { font-size: 15px; color: var(--text-3); font-weight: 500; }

/* ---------- Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--grid-min), 1fr));
  gap: var(--grid-gap);
}
html[data-density="compact"] { --grid-min: 250px; --grid-gap: 16px; }

/* ---------- Card ---------- */
.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-card); overflow: hidden; cursor: pointer;
  box-shadow: var(--shadow-rest);
  transition: transform 0.32s var(--ease), box-shadow 0.32s var(--ease), border-color 0.32s var(--ease);
}
.card.in { opacity: 1; }
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); border-color: var(--hairline-strong); }
.card:active { transform: translateY(-2px) scale(0.995); }

.tile {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  display: grid; place-items: center;
}
.tile .tile-grad { position: absolute; inset: 0; }
.tile .tile-grad::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 18% 12%, rgba(255,255,255,0.32), transparent 55%);
}
.tile .glyph {
  position: relative; width: 30%; max-width: 78px; color: #fff;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.22));
  transition: transform 0.5s var(--ease-spring);
}
.card:hover .tile .glyph { transform: scale(1.07) rotate(-2deg); }
.tile img.shot {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 0.5s var(--ease);
}
.tile img.shot.ready { opacity: 1; }
.tile .cat-tag {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em; color: #fff;
  padding: 5px 10px; border-radius: var(--r-pill);
  background: rgba(0,0,0,0.28); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}

.card-body { padding: 17px 19px 19px; display: flex; flex-direction: column; flex: 1; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-title { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.card-tagline {
  margin: 5px 0 0; color: var(--text-2); font-size: 14px; line-height: 1.45;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.card-foot {
  margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--hairline);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 12.5px; color: var(--text-3);
}
.card-foot .meta { display: inline-flex; align-items: center; gap: 7px; }
.card-foot .lang-dot { width: 9px; height: 9px; border-radius: 50%; }
.card-open {
  display: inline-flex; align-items: center; gap: 5px; color: var(--accent); font-weight: 600;
  opacity: 0; transform: translateX(-4px); transition: all 0.25s var(--ease);
}
.card:hover .card-open { opacity: 1; transform: translateX(0); }
.card-open svg { width: 13px; height: 13px; }

/* ---------- Featured spotlight ---------- */
.featured {
  position: relative; border-radius: 28px; overflow: hidden; cursor: pointer;
  display: grid; grid-template-columns: 1fr; min-height: 320px;
  box-shadow: var(--shadow-rest); margin-bottom: 44px;
  transition: transform 0.4s var(--ease), box-shadow 0.32s var(--ease);
}
.featured.in { opacity: 1; }
.featured:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
@media (min-width: 760px) { .featured { grid-template-columns: 1.05fr 0.95fr; } }
.featured .feat-art { position: relative; min-height: 240px; overflow: hidden; display: grid; place-items: center; }
.featured .feat-art .tile-grad { position: absolute; inset: 0; }
.featured .feat-art .tile-grad::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(110% 80% at 20% 10%, rgba(255,255,255,0.32), transparent 55%);
}
.featured .feat-art .glyph { position: relative; width: 120px; color: #fff; filter: drop-shadow(0 8px 24px rgba(0,0,0,0.28)); transition: transform 0.6s var(--ease-spring); }
.featured:hover .feat-art .glyph { transform: scale(1.06) rotate(-2deg); }
.featured .feat-art img.shot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.5s var(--ease); }
.featured .feat-art img.shot.ready { opacity: 1; }
.featured .feat-body { background: var(--surface); padding: 36px 36px 34px; display: flex; flex-direction: column; justify-content: center; }
.featured .feat-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin: 0 0 14px; }
.featured h2 { margin: 0 0 10px; font-size: clamp(26px, 3.4vw, 38px); font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; }
.featured .feat-desc { margin: 0; color: var(--text-2); font-size: 16px; line-height: 1.55; max-width: 46ch; }
.featured .feat-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.featured .feat-tags span {
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
  background: var(--surface-sunk); padding: 6px 12px; border-radius: var(--r-pill);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 22px; border-radius: var(--r-pill);
  font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
  transition: transform 0.18s var(--ease), box-shadow 0.2s var(--ease), background-color 0.2s var(--ease), opacity 0.2s var(--ease);
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: var(--accent-text); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 32%, transparent); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 40%, transparent); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: var(--surface-sunk); color: var(--text); border: 1px solid var(--hairline); }
.btn-secondary:hover { background: var(--bg-2); transform: translateY(-2px); }
.btn-secondary:active { transform: translateY(0); }
.btn .arrow { transition: transform 0.2s var(--ease); }
.btn:hover .arrow { transform: translate(2px, -2px); }

/* ---------- Modal ---------- */
.modal-scrim {
  position: fixed; inset: 0; z-index: 100; background: var(--scrim);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 24px;
  opacity: 0; pointer-events: none; transition: opacity 0.3s var(--ease);
}
.modal-scrim.open { opacity: 1; pointer-events: auto; }
.modal {
  width: min(720px, 100%); max-height: min(88vh, 860px); overflow: hidden;
  background: var(--surface); border-radius: 28px; box-shadow: var(--shadow-modal);
  display: flex; flex-direction: column;
  transform: scale(0.94) translateY(12px); opacity: 0;
  transition: transform 0.4s var(--ease-spring), opacity 0.3s var(--ease);
}
.modal-scrim.open .modal { transform: scale(1) translateY(0); opacity: 1; }
.modal-scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-art { position: relative; height: clamp(150px, 24vh, 224px); overflow: hidden; display: grid; place-items: center; }
.modal-art .tile-grad { position: absolute; inset: 0; }
.modal-art .tile-grad::after { content: ""; position: absolute; inset: 0; background: radial-gradient(110% 80% at 22% 8%, rgba(255,255,255,0.3), transparent 55%); }
.modal-art .glyph { position: relative; width: 76px; color: #fff; filter: drop-shadow(0 8px 24px rgba(0,0,0,0.28)); }
.modal-art img.shot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.5s var(--ease); }
.modal-art img.shot.ready { opacity: 1; }
.modal-close {
  position: absolute; top: 16px; right: 16px; z-index: 3;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  background: rgba(0,0,0,0.32); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: background-color 0.18s var(--ease), transform 0.18s var(--ease);
}
.modal-close:hover { background: rgba(0,0,0,0.5); transform: scale(1.06); }
.modal-close svg { width: 17px; height: 17px; }

.modal-body { padding: 30px 34px 34px; }
.modal-cat { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; }
.modal-body h2 { margin: 0 0 12px; font-size: clamp(26px, 4vw, 34px); font-weight: 600; letter-spacing: -0.03em; }
.modal-desc { margin: 0; color: var(--text-2); font-size: 16.5px; line-height: 1.6; }
.modal-highlights { margin: 26px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.modal-highlights li { display: flex; align-items: flex-start; gap: 12px; font-size: 15px; color: var(--text); }
.modal-highlights li svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; color: var(--accent); }
.modal-meta { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 26px 0 0; padding-top: 22px; border-top: 1px solid var(--hairline); font-size: 13.5px; color: var(--text-3); }
.modal-meta .item { display: inline-flex; align-items: center; gap: 7px; }
.modal-meta .lang-dot { width: 9px; height: 9px; border-radius: 50%; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.modal-actions .btn { flex: 1 1 auto; }

/* ---------- Skeleton ---------- */
@keyframes shimmer { 0% { background-position: -480px 0; } 100% { background-position: 480px 0; } }
.skel { background: linear-gradient(90deg, var(--skel-a) 0%, var(--skel-b) 50%, var(--skel-a) 100%); background-size: 900px 100%; animation: shimmer 1.5s linear infinite; border-radius: 8px; }
.card.skel-card { cursor: default; opacity: 1; transform: none; pointer-events: none; }
.card.skel-card .tile { background: var(--skel-a); }
.skel-line { height: 13px; border-radius: 6px; }

/* ---------- States ---------- */
.state { grid-column: 1 / -1; text-align: center; padding: 72px 24px; }
.state .ico { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 18px; background: var(--surface-sunk); color: var(--text-3); }
.state .ico svg { width: 26px; height: 26px; }
.state h3 { margin: 0 0 8px; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.state p { margin: 0 auto; max-width: 42ch; color: var(--text-2); font-size: 15px; }
.state .btn { margin-top: 22px; }

/* ---------- Footer ---------- */
.footer {
  margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--hairline);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px;
  font-size: 13px; color: var(--text-3);
}
.footer a { color: var(--text-2); transition: color 0.15s var(--ease); }
.footer a:hover { color: var(--text); }
.footer .links { display: flex; gap: 18px; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .card, .featured { opacity: 1 !important; transform: none !important; }
}
