/* ============================================================
   CricML — Warm Editorial ("Sports Almanac") design system
   Palette borrowed from stats-desk.aryaman.ink · light theme only
   ============================================================ */

:root {
  /* paper + ink */
  --paper:   #F6F1E8;   /* page background  */
  --paper2:  #FBF7EE;   /* raised card      */
  --paper3:  #EFE7D8;   /* sunken / wells   */
  --ink:     #1C1714;   /* primary text     */
  --ink2:    #4A3F36;   /* secondary text   */
  --muted:   #8A7A68;   /* metadata         */
  --rule:    #D9CDB6;   /* hairlines        */

  /* accents */
  --accent:  #B33A1A;   /* brick red — signature */
  --accent2: #8F2D14;   /* darker red for hovers */
  --gold:    #C8932B;   /* secondary  */
  --green:   #3F8F4E;   /* tertiary   */

  /* type */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans:  ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  /* scale */
  --container: 1240px;
  --radius:  14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(28,23,20,.05), 0 2px 8px rgba(28,23,20,.04);
  --shadow:    0 6px 20px rgba(28,23,20,.10), 0 1px 3px rgba(28,23,20,.06);
  --shadow-lg: 0 18px 50px rgba(28,23,20,.18);
}

/* ---------- reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* faint paper grain for atmosphere */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 700; line-height: 1.08; letter-spacing: -.01em; margin: 0; }
.container { max-width: var(--container); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2.5rem); }

/* shared eyebrow / kicker */
.eyebrow {
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.nav__inner {
  display: flex; align-items: center; gap: 1.5rem;
  height: 66px;
  max-width: var(--container); margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}
.brand { display: inline-flex; align-items: baseline; gap: .12rem; font-family: var(--serif); font-weight: 700; font-size: 1.35rem; letter-spacing: -.02em; }
.brand__dot { width: .42rem; height: .42rem; border-radius: 50%; background: var(--accent); display: inline-block; transform: translateY(-.05rem); }
.nav__search {
  flex: 1 1 auto; max-width: 420px; margin-inline: auto;
  display: flex; align-items: center; gap: .5rem;
  background: var(--paper2);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: .45rem 1rem;
  transition: border-color .2s, box-shadow .2s;
}
.nav__search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(179,58,26,.12); }
.nav__search svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.nav__search input {
  border: 0; background: transparent; outline: none; width: 100%;
  font-family: var(--sans); font-size: .9rem; color: var(--ink);
}
.nav__search input::placeholder { color: var(--muted); }
.nav__links { display: flex; align-items: center; gap: 1.4rem; flex: none; }
.nav__links a { font-size: .88rem; font-weight: 600; color: var(--ink2); transition: color .15s; }
.nav__links a:hover { color: var(--accent); }
.nav__cta {
  font-size: .85rem; font-weight: 700; color: #fff; background: var(--accent);
  padding: .5rem .95rem; border-radius: 999px; transition: background .15s, transform .15s;
}
.nav__cta:hover { background: var(--accent2); transform: translateY(-1px); }
@media (max-width: 760px) {
  .nav__search { display: none; }
  .nav__links .hide-sm { display: none; }
}

/* ---------- category chips ---------- */
.chips {
  display: flex; gap: .55rem; overflow-x: auto; scrollbar-width: none;
  padding: 1.1rem 0 .2rem;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; cursor: pointer;
  font-family: var(--sans); font-size: .82rem; font-weight: 600; white-space: nowrap;
  color: var(--ink2);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: .42rem .95rem;
  transition: all .15s;
}
.chip:hover { border-color: var(--ink2); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------- two-tone section header ---------- */
.sec-head { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; margin: 2.6rem 0 1.3rem; }
.sec-head h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.sec-head .sub { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: clamp(1.1rem, 2.2vw, 1.5rem); color: var(--accent); }
.sec-rule { flex: 1 1 60px; height: 1px; background: var(--rule); align-self: center; min-width: 30px; }

/* ============================================================
   GRAPHIC THUMBNAIL SYSTEM  (CSS/SVG composite, no produced art)
   color-field by category + texture + chart inset + overlays
   ============================================================ */
.thumb {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: var(--field, var(--ink));
  isolation: isolate;
}
/* color-field per category sets --field + --on (overlay text color) */
.cat-strategy   { --field: #B33A1A; --on: #fff; --chip-bg: #fff; --chip-fg: #B33A1A; }
.cat-valuation  { --field: #C8932B; --on: #1C1714; --chip-bg: #1C1714; --chip-fg: #fff; }
.cat-evaluation { --field: #3F8F4E; --on: #fff; --chip-bg: #fff; --chip-fg: #2c6b39; }
.cat-engine     { --field: #1C1714; --on: #fff; --chip-bg: #B33A1A; --chip-fg: #fff; }
.cat-batting    { --field: #2f8779; --on: #fff; --chip-bg: #fff; --chip-fg: #2f8779; }

/* image fills the thumbnail — the photo is the hero of the card */
.thumb__img {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%; object-fit: cover; object-position: center;
  transition: transform .5s ease;
}
/* graphic fallback — only for cards with no photo (e.g. the engine card) */
.thumb--graphic::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(120% 90% at 18% 12%, rgba(255,255,255,.20), transparent 55%),
    radial-gradient(130% 120% at 100% 100%, rgba(0,0,0,.34), transparent 60%);
}
.thumb--graphic .thumb__tex {
  position: absolute; inset: -10%; z-index: 0; opacity: .5; mix-blend-mode: soft-light;
  background:
    repeating-conic-gradient(from 0deg at 30% 30%,
      rgba(255,255,255,.5) 0deg, rgba(255,255,255,.5) 2deg, transparent 2deg, transparent 11deg);
  -webkit-mask-image: radial-gradient(60% 60% at 30% 30%, #000 0%, transparent 70%);
          mask-image: radial-gradient(60% 60% at 30% 30%, #000 0%, transparent 70%);
}
.thumb--graphic .thumb__dots {
  position: absolute; inset: 0; z-index: 0; opacity: .22; mix-blend-mode: overlay;
  background-image: radial-gradient(rgba(255,255,255,.9) 1.1px, transparent 1.2px);
  background-size: 11px 11px;
  -webkit-mask-image: linear-gradient(115deg, #000 0 35%, transparent 70%);
          mask-image: linear-gradient(115deg, #000 0 35%, transparent 70%);
}
/* legibility scrim — strong where the title sits, clear over the image above */
.thumb__scrim {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to top, rgba(20,15,12,.84) 0%, rgba(20,15,12,.46) 26%, rgba(20,15,12,.06) 52%, transparent 72%);
}
/* thin category accent along the bottom edge */
.thumb__scrim::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--field); }
.thumb__overlay { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; justify-content: space-between; padding: 1rem 1.1rem; }
.thumb__pill {
  align-self: flex-start;
  font-family: var(--sans); font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  background: var(--chip-bg); color: var(--chip-fg);
  padding: .3rem .6rem; border-radius: 999px; box-shadow: 0 2px 8px rgba(0,0,0,.20);
}
.thumb__title { color: #fff; font-size: clamp(1.15rem, 2vw, 1.55rem); text-shadow: 0 2px 14px rgba(0,0,0,.55); max-width: 92%; }
.thumb__meta { display: flex; align-items: center; gap: .55rem; margin-top: .6rem; color: #fff; font-size: .78rem; opacity: .95; text-shadow: 0 1px 8px rgba(0,0,0,.5); }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-family: var(--sans); font-size: .68rem; font-weight: 800; letter-spacing: .02em;
  background: rgba(255,255,255,.95); color: var(--ink);
  border: 1.5px solid rgba(255,255,255,.6);
}
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }

/* ---------- hero feature ---------- */
.hero { margin-top: .6rem; }
.hero .thumb { aspect-ratio: 16/6.4; min-height: 340px; box-shadow: var(--shadow-lg); }
.hero .thumb__overlay { padding: clamp(1.2rem, 3vw, 2.4rem); }
/* extra left scrim so the big title reads over a busy image */
.hero .thumb__scrim {
  background:
    linear-gradient(to top, rgba(20,15,12,.86) 0%, rgba(20,15,12,.5) 24%, rgba(20,15,12,.12) 50%, transparent 72%),
    linear-gradient(to right, rgba(20,15,12,.62), rgba(20,15,12,.15) 45%, transparent 65%);
}
.hero .thumb__title { font-size: clamp(1.8rem, 4.2vw, 3.4rem); max-width: 18ch; }
.hero .thumb__pill { font-size: .72rem; }
.hero .thumb__meta { font-size: .85rem; }
.hero a:hover .thumb__img { transform: scale(1.04); }
@media (max-width: 640px) {
  .hero .thumb { aspect-ratio: 4/5; min-height: 0; }
}

/* ---------- article card ---------- */
.feed { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.4rem; }
.card { display: block; transition: transform .2s; }
.card .thumb { aspect-ratio: 5/4; box-shadow: var(--shadow); }
.card:hover { transform: translateY(-4px); }
.card:hover .thumb__img { transform: scale(1.05); }
.card__foot { padding: .75rem .2rem 0; }
.card__title-sm { font-size: 1.18rem; line-height: 1.18; transition: color .15s; }
.card:hover .card__title-sm { color: var(--accent); }
.card__excerpt { color: var(--ink2); font-size: .9rem; margin: 0; }
.card__more { display: inline-flex; align-items: center; gap: .35rem; margin-top: .6rem; font-size: .82rem; font-weight: 700; color: var(--accent); }
.card__more svg { width: 15px; height: 15px; transition: transform .15s; }
.card:hover .card__more svg { transform: translateX(3px); }

/* ---------- layout: feed + rail ---------- */
.split { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 2.4rem; align-items: start; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }
.rail { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 1.2rem; }
@media (max-width: 1000px) { .rail { position: static; } }

/* ---------- project rail card ---------- */
.panel { background: var(--paper2); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.proj { padding: 1.3rem; position: relative; overflow: hidden; }
.proj__badge { font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.proj h3 { font-size: 1.45rem; margin: .35rem 0 .5rem; }
.proj p { font-size: .9rem; color: var(--ink2); margin: 0 0 .9rem; }
.statchips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.statchip { font-size: .74rem; font-weight: 600; color: var(--ink2); background: var(--paper3); border: 1px solid var(--rule); border-radius: 999px; padding: .3rem .6rem; }
.statchip b { color: var(--accent); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font-family: var(--sans); font-weight: 700; font-size: .9rem; border-radius: 10px; padding: .65rem 1rem; cursor: pointer; transition: all .15s; width: 100%; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent2); transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
.btn--ghost:hover { border-color: var(--ink); }
.btn-row { display: flex; flex-direction: column; gap: .55rem; }

/* ---------- mini leaderboard ---------- */
.lead { padding: 1.1rem 1.3rem 1.3rem; }
.lead h4 { font-size: 1.05rem; margin-bottom: .25rem; }
.lead .cap { font-size: .76rem; color: var(--muted); margin-bottom: .8rem; }
.lrow { display: grid; grid-template-columns: 1.2rem 1fr auto auto; gap: .55rem; align-items: center; padding: .5rem 0; border-top: 1px solid var(--rule); font-size: .86rem; }
.lrow:first-of-type { border-top: 0; }
.lrow .rk { font-family: var(--serif); font-weight: 700; color: var(--muted); }
.lrow.top .rk { color: var(--gold); }
.lrow .nm { font-weight: 600; }
.lrow .met { font-variant-numeric: tabular-nums; color: var(--ink2); }
.lrow .edge { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); }
.lrow.top { background: linear-gradient(90deg, rgba(179,58,26,.06), transparent); }

/* ---------- generic content (project page) ---------- */
.prose-hero { padding: clamp(2.4rem,6vw,4.5rem) 0 1rem; text-align: center; position: relative; }
.prose-hero h1 { font-size: clamp(2.4rem, 6vw, 4.4rem); }
.prose-hero .lede { font-size: clamp(1.05rem,2.2vw,1.3rem); color: var(--ink2); max-width: 46ch; margin: 1.1rem auto 0; }
.statband { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; margin: 2.4rem auto; max-width: 760px; }
@media (max-width:620px){ .statband { grid-template-columns: repeat(2,1fr); } }
.statband .s { text-align: center; background: var(--paper2); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.2rem .6rem; box-shadow: var(--shadow-sm); }
.statband .s b { display: block; font-family: var(--serif); font-size: clamp(1.8rem,4vw,2.6rem); color: var(--accent); line-height: 1; }
.statband .s span { font-size: .8rem; color: var(--muted); }

.band { padding: 3rem 0; }
.band--wells { background: var(--paper3); border-block: 1px solid var(--rule); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
@media (max-width: 760px){ .grid2 { grid-template-columns: 1fr; } }

.cardp { background: var(--paper2); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow-sm); }
.cardp--accent { border-color: var(--accent); border-width: 2px; }
.cardp h3 { font-size: 1.3rem; margin-bottom: .4rem; }
.bignum { font-family: var(--serif); font-weight: 700; font-size: clamp(2.2rem,5vw,3.2rem); line-height: 1; }
.bignum--red { color: var(--accent); }
.bignum--muted { color: var(--muted); }

.callout { border-left: 4px solid var(--accent); background: var(--paper2); border-radius: 0 var(--radius) var(--radius) 0; padding: 1.2rem 1.4rem; box-shadow: var(--shadow-sm); }
.callout h4 { font-family: var(--serif); font-size: 1.15rem; margin-bottom: .3rem; }
.callout p { margin: 0; color: var(--ink2); font-size: .95rem; }

/* pipeline */
.pipe { display: grid; grid-template-columns: repeat(5,1fr); gap: .8rem; }
@media (max-width: 760px){ .pipe { grid-template-columns: repeat(2,1fr); } }
.pipe .step { text-align: center; }
.pipe .num { width: 52px; height: 52px; margin: 0 auto .6rem; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-family: var(--serif); font-weight: 700; font-size: 1.3rem; box-shadow: var(--shadow-sm); }
.pipe .step h4 { font-size: 1.02rem; }
.pipe .step p { font-size: .78rem; color: var(--muted); margin: .2rem 0 0; }

/* feature category tiles */
.feat-grid { display: grid; grid-template-columns: repeat(6,1fr); gap: .7rem; }
@media (max-width: 900px){ .feat-grid { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 520px){ .feat-grid { grid-template-columns: repeat(2,1fr); } }
.feat { text-align: center; border-radius: var(--radius-sm); padding: 1rem .5rem; border: 1px solid var(--rule); background: var(--paper2); }
.feat b { display:block; font-family: var(--serif); font-size: 1.7rem; line-height: 1; }
.feat span { font-size: .72rem; font-weight: 700; }
.feat small { display:block; font-size: .68rem; color: var(--muted); margin-top: .2rem; }
.c-match b,.c-match span{color:#3b82f6}.c-player b,.c-player span{color:#2c8a63}
.c-momentum b,.c-momentum span{color:var(--gold)}.c-chase b,.c-chase span{color:var(--accent)}
.c-matchup b,.c-matchup span{color:#7c5cc4}.c-context b,.c-context span{color:#c0497f}

/* leaderboard table */
.lbwrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper2); box-shadow: var(--shadow-sm); }
table.lb { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.lb th { text-align: center; font-family: var(--sans); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: .9rem 1rem; border-bottom: 1px solid var(--rule); }
table.lb th:nth-child(2){ text-align: left; }
table.lb td { padding: .9rem 1rem; text-align: center; border-bottom: 1px solid var(--rule); }
table.lb td:nth-child(2){ text-align: left; font-weight: 600; }
table.lb tr:last-child td { border-bottom: 0; }
table.lb tr.win { background: linear-gradient(90deg, rgba(179,58,26,.06), transparent); }
table.lb tr.win td { color: var(--accent); }
.rkpill { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-family: var(--serif); font-weight: 700; font-size: .85rem; color:#fff; background: var(--muted); }
.rkpill.g { background: var(--gold); }

.chartbox { background: var(--paper2); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow-sm); max-width: 820px; margin: 0 auto; }
.chartbox .h { height: 280px; position: relative; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--rule); margin-top: 4rem; background: var(--paper2); }
.foot__inner { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 2.5rem 0; text-align: center; }
.foot__links { display: flex; flex-wrap: wrap; gap: 1.4rem; }
.foot__links a { font-size: .88rem; color: var(--ink2); }
.foot__links a:hover { color: var(--accent); }
.foot__copy { font-size: .82rem; color: var(--muted); }

/* ---------- entrance motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.rise { opacity: 0; animation: rise .6s cubic-bezier(.2,.7,.2,1) forwards; }
.rise:nth-child(2){ animation-delay: .06s; } .rise:nth-child(3){ animation-delay: .12s; }
.rise:nth-child(4){ animation-delay: .18s; } .rise:nth-child(5){ animation-delay: .24s; }
@media (prefers-reduced-motion: reduce){ .rise { animation: none; opacity: 1; } html { scroll-behavior: auto; } }

/* filter hide */
.is-hidden { display: none !important; }
