/* ===========================================================================
   The Sigma Journal — editorial layout, image placeholders & motion
   Layered on top of site.css. Used by Journal.html and the article template.
   =========================================================================== */

:root {
  --jmax: 1280px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------------------------------------------------------------------------
   Reveal primitives (journal-local so they don't fight site.js pinning)
   --------------------------------------------------------------------------- */
.j-reveal { opacity: 1; transform: none; }
html.reveal-ready .j-reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 900ms var(--ease-out), transform 1000ms var(--ease-out);
}
html.reveal-ready .j-reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html.reveal-ready .j-reveal { opacity: 1; transform: none; transition: none; }
}

/* ===========================================================================
   Masthead
   =========================================================================== */
.j-masthead { position: relative; overflow: hidden; padding: clamp(40px, 6vw, 80px) 0 clamp(30px, 4vw, 46px); background: linear-gradient(180deg, var(--cream-soft), var(--cream)); border-bottom: 1px solid var(--border); }
.j-masthead .container { width: min(100%, var(--jmax)); position: relative; z-index: 1; }
/* faint oversized serif sigma watermark drifting behind the title */
.j-watermark { position: absolute; top: 50%; right: clamp(-40px, -2vw, 0px); transform: translateY(-50%); font-family: var(--serif); font-style: italic; font-size: clamp(280px, 38vw, 560px); line-height: 1; color: var(--gold); opacity: 0.06; pointer-events: none; z-index: 0; user-select: none; }
.j-mast-top { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.j-mast-top .rule { flex: 1; height: 1px; min-width: 30px; background: linear-gradient(90deg, var(--gold-soft), transparent); }
.j-kicker { display: inline-flex; align-items: center; gap: 10px; color: var(--gold-text); font-size: var(--fs-micro); font-weight: 700; letter-spacing: 3px; text-transform: uppercase; }
.j-issue { color: var(--ink-muted); font-size: var(--fs-micro); letter-spacing: 2px; text-transform: uppercase; font-weight: 600; }
.j-masthead h1 { font-size: clamp(54px, 8.4vw, 128px); line-height: 0.92; letter-spacing: -1.5px; margin-bottom: 22px; }
.j-masthead h1 .gold { display: inline; }
.j-mast-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(24px, 4vw, 60px); align-items: end; }
.j-mast-lead { max-width: 52ch; color: var(--ink-soft); font-size: var(--fs-lead); line-height: 1.7; }
.j-mast-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 18px; color: var(--ink-muted); font-size: var(--fs-meta); }
.j-mast-meta b { color: var(--ink); font-weight: 600; }

/* search field */
.j-search { position: relative; width: 100%; }
.j-search svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 19px; height: 19px; color: var(--gold-deep); stroke-width: 1.7; pointer-events: none; transition: color 200ms ease; }
.j-search input { width: 100%; height: 58px; padding: 0 48px 0 50px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--white); color: var(--ink); font-family: var(--sans); font-size: var(--fs-body); transition: border-color 220ms ease, box-shadow 220ms ease, background 220ms ease; }
.j-search input::placeholder { color: var(--ink-muted); }
.j-search input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(199, 163, 92, 0.16); background: var(--white); }
.j-search:focus-within svg { color: var(--gold-text); }
.j-search .j-clear { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: none; border-radius: 50%; background: var(--cream-deep); color: var(--ink-soft); cursor: pointer; display: none; align-items: center; justify-content: center; transition: background 160ms ease, color 160ms ease; }
.j-search .j-clear svg { position: static; transform: none; width: 14px; height: 14px; color: inherit; }
.j-search .j-clear:hover { background: var(--ink); color: var(--white); }
.j-search.has-value .j-clear { display: flex; }

/* ===========================================================================
   Journal image frames
   =========================================================================== */
.ph { position: relative; overflow: hidden; background: linear-gradient(135deg, #f1e7d0 0%, #f7f0e1 48%, #ece0c6 100%); }
.ph::before {
  content: "";
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(135deg, rgba(168, 132, 60, 0.10) 0 1px, transparent 1px 13px);
  opacity: 0.9;
}
.ph > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ph::after { content: ""; position: absolute; inset: 10px; border: 1px solid rgba(168, 132, 60, 0.22); pointer-events: none; }

/* ===========================================================================
   Featured (editor's pick) — big split + two stacked secondary picks
   =========================================================================== */
.j-featured { padding: clamp(34px, 4.5vw, 56px) 0 clamp(20px, 2.5vw, 30px); }
.j-featured .container { width: min(100%, var(--jmax)); }
.j-section-label { display: flex; align-items: center; gap: 14px; margin-bottom: clamp(20px, 2.5vw, 30px); }
.j-section-label .t { color: var(--ink); font-family: var(--serif); font-size: var(--fs-h3-lg); white-space: nowrap; }
.j-section-label .rule { flex: 1; height: 1px; background: var(--border); }
.j-section-label .n { color: var(--ink-muted); font-size: var(--fs-meta); letter-spacing: 1.5px; text-transform: uppercase; }

.j-feature-row { display: grid; grid-template-columns: 1.62fr 1fr; gap: clamp(20px, 2.6vw, 34px); align-items: stretch; }
.j-secondary { display: grid; grid-template-rows: 1fr 1fr; gap: clamp(20px, 2.6vw, 34px); min-width: 0; }

/* the hero pick */
.j-hero-pick { position: relative; display: grid; grid-template-rows: auto; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--white); box-shadow: var(--shadow-card); transition: transform 280ms var(--ease-out), box-shadow 280ms var(--ease-out), border-color 280ms var(--ease-out); }
.j-hero-pick .ph { aspect-ratio: 16 / 9; }
.j-hero-pick .ph > img, .j-card .ph > img, .j-pick .ph > img { transition: transform 600ms var(--ease-out); }
.j-hero-pick:hover { transform: translateY(-6px); box-shadow: var(--shadow-soft); border-color: var(--gold-soft); }
.j-hero-pick:hover .ph > img { transform: scale(1.05); }
.j-hero-body { padding: clamp(24px, 2.6vw, 38px); display: flex; flex-direction: column; }
.j-pill { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; margin-bottom: 16px; padding: 5px 13px; border-radius: var(--radius-pill); background: var(--cream-deep); color: var(--gold-strong); font-size: 10.5px; font-weight: 700; letter-spacing: 1.3px; text-transform: uppercase; white-space: nowrap; }
.j-pill.edit { background: var(--ink); color: var(--cream); }
.j-hero-body h2 { font-size: clamp(28px, 3.2vw, 42px); line-height: 1.07; letter-spacing: -0.4px; margin-bottom: 14px; }
.j-hero-body .dek { color: var(--ink-soft); font-size: var(--fs-lead); line-height: 1.62; margin-bottom: 20px; max-width: 56ch; }
.j-byline { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-top: auto; color: var(--ink-muted); font-size: var(--fs-meta); }
.j-byline .who { color: var(--ink); font-weight: 600; white-space: nowrap; }
.j-readlink { white-space: nowrap; }
.j-byline .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--gold-deep); }
.j-readlink { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; color: var(--gold-text); font-size: var(--fs-sm); font-weight: 700; }
.j-readlink svg { width: 16px; height: 16px; transition: transform 200ms ease; }
.j-hero-pick:hover .j-readlink svg, .j-pick:hover .j-readlink svg { transform: translateX(4px); }

/* secondary picks — horizontal cards */
.j-pick { position: relative; display: grid; grid-template-columns: 0.9fr 1.1fr; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--white); box-shadow: 0 1px 0 rgba(255,255,255,0.7) inset; transition: transform 260ms var(--ease-out), box-shadow 260ms var(--ease-out), border-color 260ms var(--ease-out); min-height: 0; }
.j-pick:hover { transform: translateY(-5px); box-shadow: var(--shadow-card); border-color: var(--gold-soft); }
.j-pick:hover .ph > img { transform: scale(1.06); }
.j-pick .ph { height: 100%; min-height: 150px; }
.j-pick-body { padding: clamp(18px, 1.9vw, 26px); display: flex; flex-direction: column; }
.j-pick-body h3 { font-size: clamp(19px, 1.5vw, 23px); line-height: 1.16; margin-bottom: 8px; }
.j-pick-body p { color: var(--ink-soft); font-size: var(--fs-sm); line-height: 1.5; flex: 1; }
.j-pick-body .j-byline { margin-top: 14px; }

/* ===========================================================================
   Sticky toolbar — topic filters
   =========================================================================== */
.j-toolbar { position: sticky; top: var(--navh, 74px); z-index: 20; background: rgba(251, 247, 239, 0.92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 12px 0; }
.j-toolbar .container { width: min(100%, var(--jmax)); }
.j-toolbar-inner { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; }
.j-chips { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 auto; min-width: 0; padding: 2px; scroll-behavior: smooth; }
.j-chips::-webkit-scrollbar { display: none; }
.j-chip { flex: 0 0 auto; padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--white); color: var(--ink-soft); font-size: var(--fs-meta); font-weight: 600; cursor: pointer; white-space: nowrap; transition: background 200ms var(--ease-out), color 200ms var(--ease-out), border-color 200ms var(--ease-out), transform 200ms var(--ease-out); }
.j-chip:hover { border-color: var(--gold-strong); color: var(--ink); transform: translateY(-1px); }
.j-chip.is-active { background: var(--ink); color: var(--white); border-color: var(--ink); }
.j-chip .c { opacity: 0.55; font-weight: 600; margin-left: 5px; }
.j-chip.is-active .c { opacity: 0.7; }
.j-count { flex: 0 0 auto; color: var(--ink-muted); font-size: var(--fs-meta); white-space: nowrap; padding-left: 16px; border-left: 1px solid var(--border); margin-left: auto; }
.j-count b { color: var(--ink); font-weight: 700; }

/* ===========================================================================
   Library grid
   =========================================================================== */
.j-library { padding: clamp(30px, 4vw, 52px) 0 clamp(40px, 5vw, 64px); }
.j-library .container { width: min(100%, var(--jmax)); }
.j-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(20px, 2.4vw, 32px); }

.j-card { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--white); box-shadow: 0 1px 0 rgba(255,255,255,0.7) inset; transition: transform 240ms var(--ease-out), box-shadow 240ms var(--ease-out), border-color 240ms var(--ease-out); }
.j-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-card); border-color: var(--gold-soft); }
.j-card:hover .ph > img { transform: scale(1.06); }
.j-card .ph { aspect-ratio: 3 / 2; }
.j-card-body { display: flex; flex-direction: column; flex: 1; padding: 22px 22px 24px; }
.j-card .cat { display: inline-flex; align-self: flex-start; margin-bottom: 12px; color: var(--gold-text); font-size: 10.5px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; }
.j-card h3 { font-size: 22px; line-height: 1.2; margin-bottom: 9px; text-wrap: pretty; }
.j-card p { color: var(--ink-soft); font-size: var(--fs-sm); line-height: 1.55; flex: 1; }
.j-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--border); }
.j-card-foot .meta { color: var(--ink-muted); font-size: var(--fs-meta); }
.j-card-foot .arrow { width: 34px; height: 34px; border: 1px solid var(--gold-soft); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--gold-text); transition: background 220ms var(--ease-out), color 220ms var(--ease-out), transform 220ms var(--ease-out); }
.j-card-foot .arrow svg { width: 15px; height: 15px; transition: transform 220ms var(--ease-out); }
.j-card:hover .arrow { background: var(--ink); color: var(--white); border-color: var(--ink); }
.j-card:hover .arrow svg { transform: translateX(2px); }

/* filtering: staggered exit/enter handled in JS via these classes */
.j-card.is-hidden, .j-card.is-out { display: none; }

/* empty state */
.j-empty { display: none; text-align: center; padding: clamp(40px, 6vw, 80px) 20px; }
.j-empty.show { display: block; }
.j-empty .glyph { width: 56px; height: 56px; margin: 0 auto 18px; color: var(--gold-deep); opacity: 0.7; }
.j-empty h3 { font-size: var(--fs-h3-lg); margin-bottom: 8px; }
.j-empty p { color: var(--ink-muted); font-size: var(--fs-body); margin-bottom: 20px; }

/* ===========================================================================
   Most read + newsletter band
   =========================================================================== */
.j-band { background: var(--cream-soft); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.j-band .container { width: min(100%, var(--jmax)); }
.j-band-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(34px, 5vw, 72px); padding: clamp(40px, 5vw, 64px) 0; align-items: start; }

.j-popular h2, .j-news h2 { font-size: var(--fs-h2); line-height: 1.05; margin-bottom: 8px; }
.j-popular .sub, .j-news .sub { color: var(--ink-muted); font-size: var(--fs-sm); margin-bottom: clamp(20px, 2.5vw, 28px); }
.j-poplist { display: grid; gap: 4px; }
.j-pop { display: grid; grid-template-columns: 52px 1fr; gap: 16px; align-items: center; padding: 16px 10px; border-bottom: 1px solid var(--border); transition: padding-left 240ms var(--ease-out); }
.j-pop:first-child { border-top: 1px solid var(--border); }
.j-pop:hover { padding-left: 18px; }
.j-pop .num { font-family: var(--serif); font-style: italic; font-size: 40px; line-height: 1; color: var(--gold); transition: color 240ms var(--ease-out); }
.j-pop:hover .num { color: var(--gold-text); }
.j-pop .pop-body .cat { display: block; color: var(--gold-text); font-size: 10px; font-weight: 700; letter-spacing: 1.3px; text-transform: uppercase; margin-bottom: 4px; }
.j-pop .pop-body h3 { font-size: 18px; line-height: 1.22; transition: color 200ms ease; }
.j-pop:hover .pop-body h3 { color: var(--gold-text); }

/* newsletter card */
.j-news { position: relative; padding: clamp(28px, 3vw, 40px); border: 1px solid var(--gold-soft); border-radius: var(--radius); background: linear-gradient(160deg, var(--white), var(--cream-light)); box-shadow: var(--shadow-card); overflow: hidden; }
.j-news::before { content: ""; position: absolute; width: 280px; height: 280px; right: -90px; top: -110px; border-radius: 50%; border: 1px solid rgba(199,163,92,0.25); pointer-events: none; }
.j-news .eyebrow { margin-bottom: 12px; }
.j-news p.intro { color: var(--ink-soft); font-size: var(--fs-sm); line-height: 1.6; margin-bottom: 22px; max-width: 42ch; }
.j-news form { display: flex; flex-direction: column; gap: 12px; }
.j-news .field { position: relative; }
.j-news input[type="email"] { width: 100%; height: 54px; padding: 0 18px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--white); font-family: var(--sans); font-size: var(--fs-body); color: var(--ink); transition: border-color 200ms ease, box-shadow 200ms ease; }
.j-news input[type="email"]:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(199,163,92,0.15); }
.j-news .btn { width: 100%; }
.j-news .fineprint { color: var(--ink-muted); font-size: var(--fs-micro); line-height: 1.5; margin-top: 2px; }
.j-news .j-success { display: none; align-items: center; gap: 12px; padding: 16px 18px; border-radius: var(--radius-sm); background: var(--cream-soft); border: 1px solid var(--gold-soft); color: var(--ink); font-size: var(--fs-sm); line-height: 1.5; }
.j-news .j-success svg { width: 22px; height: 22px; color: var(--gold-text); flex: 0 0 auto; }
.j-news.is-done form { display: none; }
.j-news.is-done .j-success { display: flex; animation: jPop 500ms var(--ease-out); }
@keyframes jPop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

/* ===========================================================================
   Article reading page
   =========================================================================== */
.read-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; background: transparent; }
.read-progress > i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--gold), var(--gold-deep)); transform-origin: left center; transition: width 80ms linear; }

.art-hero { position: relative; overflow: hidden; padding: clamp(34px, 5vw, 64px) 0 clamp(20px, 2.5vw, 28px); background: linear-gradient(180deg, var(--cream-soft), var(--cream)); border-bottom: 1px solid var(--border); }
.art-hero .container-narrow { max-width: 820px; }
.art-cat { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 16px; padding: 5px 14px; border-radius: var(--radius-pill); background: var(--cream-deep); color: var(--gold-strong); font-size: 11px; font-weight: 700; letter-spacing: 1.3px; text-transform: uppercase; white-space: nowrap; }
.art-hero h1 { font-size: clamp(34px, 5vw, 60px); line-height: 1.04; letter-spacing: -0.6px; margin-bottom: 18px; text-wrap: balance; }
.art-dek { color: var(--ink-soft); font-size: clamp(18px, 1.5vw, 21px); line-height: 1.6; margin-bottom: 24px; max-width: 60ch; }
.art-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; color: var(--ink-muted); font-size: var(--fs-meta); }
.art-meta .who, .art-meta span { white-space: nowrap; }
.art-avatar { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 600; font-size: 18px; color: var(--gold-text); background: linear-gradient(180deg, var(--cream-soft), var(--cream-deep)); border: 1px solid var(--gold-soft); }
.art-meta .who { color: var(--ink); font-weight: 600; }
.art-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--gold-deep); }
.art-figure { width: min(100%, 1080px); margin: clamp(22px, 3vw, 36px) auto 0; padding: 0 var(--pad); }
.art-figure .ph { aspect-ratio: 21 / 9; border-radius: var(--radius); border: 1px solid var(--border); }

.art-body { padding: clamp(34px, 5vw, 60px) 0; }
.art-body .container-narrow { max-width: 720px; }
.share-rail { position: sticky; top: calc(var(--navh, 74px) + 30px); }

/* next-up cards */
.j-next { background: var(--cream-soft); border-top: 1px solid var(--border); }
.j-next .container { width: min(100%, var(--jmax)); }
.j-next-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(18px, 2vw, 26px); margin-top: clamp(22px, 2.6vw, 32px); }

/* ===========================================================================
   Responsive
   =========================================================================== */
@media (max-width: 1080px) {
  .j-grid { grid-template-columns: repeat(2, 1fr); }
  .j-next-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 920px) {
  .j-feature-row { grid-template-columns: 1fr; }
  .j-secondary { grid-template-rows: none; grid-template-columns: 1fr 1fr; }
  .j-band-grid { grid-template-columns: 1fr; }
  .j-mast-grid { grid-template-columns: 1fr; align-items: start; }
}
@media (max-width: 760px) {
  .j-masthead h1 { font-size: clamp(46px, 15vw, 76px); }
  .j-grid { grid-template-columns: 1fr; }
  .j-secondary { grid-template-columns: 1fr; }
  .j-pick { grid-template-columns: 1fr; }
  .j-pick .ph { aspect-ratio: 16 / 9; min-height: 0; }
  .j-next-grid { grid-template-columns: 1fr; }
  .j-toolbar .j-count { display: none; }
  .j-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ph > img, .j-card, .j-hero-pick, .j-pick { transition: none !important; }
}
