/* Study home page (study/index.html): hero with a section map, DSA progress strip, area cards.
   Everything is visible by default; the only motion is the map drawing itself once, a slow
   pulse on its nodes, and hover/focus responses. All of it stops under prefers-reduced-motion. */

/* Area hues. Dark: light tints on the dark panel. Light: deeper tones for 4.5:1 on white. */
:root{
  --h-dsa:#4ADE80; --h-fund:#2DD4BF; --h-sys:#FBBF24; --h-ai:#A78BFA; --h-net:#38BDF8; --h-db:#FB7185;
  --sh-glow:rgba(74,222,128,.10); --sh-grid:rgba(236,238,242,.045);
}
:root[data-theme="light"]{
  --h-dsa:#15803D; --h-fund:#0F766E; --h-sys:#B45309; --h-ai:#7C3AED; --h-net:#0369A1; --h-db:#BE123C;
  --sh-glow:rgba(21,128,61,.08); --sh-grid:rgba(21,24,30,.06);
}

body.sh{ overflow-x:hidden; }
.sh-wrap{ position:relative; max-width:1040px; margin:0 auto; padding:56px 28px 100px; }
.sh-back{ font-family:var(--font-mono); font-size:12.5px; color:var(--accent); display:inline-block; margin-bottom:28px; }
.sh-back:hover{ text-decoration:underline; }

a:focus-visible, .sh-card:focus-visible{ outline:2px solid var(--accent); outline-offset:3px; border-radius:6px; }

/* ---------- Hero ---------- */
.sh-hero{
  position:relative; display:grid; grid-template-columns:minmax(0,1fr) 360px; gap:32px; align-items:center;
  margin-bottom:28px;
}
/* faint dot grid + one soft glow behind the map; static */
.sh-hero::before{
  content:""; position:absolute; z-index:-1; inset:-40px -28px -20px 38%;
  background:
    radial-gradient(closest-side, var(--sh-glow), transparent) center/80% 90% no-repeat,
    radial-gradient(var(--sh-grid) 1.2px, transparent 1.3px) 0 0/22px 22px;
  -webkit-mask-image:radial-gradient(ellipse at 60% 50%, #000 35%, transparent 75%);
          mask-image:radial-gradient(ellipse at 60% 50%, #000 35%, transparent 75%);
  pointer-events:none;
}
.sh-title{
  font-family:var(--font-display); font-weight:700; line-height:.9; letter-spacing:-.045em;
  font-size:clamp(64px, 11vw, 124px); margin:0 0 22px -.04em;
}
.sh-lede{ max-width:34em; color:var(--text-muted); font-size:16.5px; line-height:1.65; margin-bottom:28px; }
.sh-num{ font-family:var(--font-display); font-weight:600; color:var(--text); font-variant-numeric:tabular-nums; }
.sh-hero .ss-root{ margin-bottom:0; max-width:560px; }
.sh-hero .ss-box{ border-radius:10px; box-shadow:0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px -12px rgba(0,0,0,.6); }
:root[data-theme="light"] .sh-hero .ss-box{ box-shadow:0 8px 24px -14px rgba(20,20,20,.25); }
.sh-hero .ss-input{ font-size:15.5px; padding:16px 0; }

/* ---------- Section map ---------- */
.sh-map{ width:100%; height:auto; overflow:visible; }
.sh-edges line{ stroke:var(--panel-border); stroke-width:1.2; }
.sh-edges line.d1{ stroke:color-mix(in srgb, var(--h) 45%, var(--panel-border)); stroke-width:1.5; }
.sh-edges line.x{ stroke-dasharray:3 4; }
.sh-leaves circle{ fill:var(--bg); stroke:var(--text-dim); stroke-width:1.2; }
.sh-root-dot{ fill:var(--accent); }
.sh-root-halo{ fill:none; stroke:var(--accent); stroke-opacity:.35; stroke-width:1.2; }
.sh-node .dot{ fill:var(--bg); stroke:var(--h); stroke-width:2.4; transition:fill .25s ease; }
.sh-node .halo{
  fill:var(--h); fill-opacity:0; stroke:var(--h); stroke-opacity:.3; stroke-width:1;
  transform-box:fill-box; transform-origin:center; transition:fill-opacity .25s ease, transform .3s ease;
}
.sh-node.is-hot .dot{ fill:var(--h); }
.sh-node.is-hot .halo{ fill-opacity:.16; transform:scale(1.35); stroke-opacity:.6; }

/* ---------- Progress strip ---------- */
.sh-progress{
  display:flex; align-items:center; gap:18px; margin-bottom:28px;
  padding:16px 18px; border:1px solid var(--panel-border); border-radius:12px;
  background:linear-gradient(100deg, color-mix(in srgb, var(--accent) 7%, var(--panel)), var(--panel) 55%);
}
.sh-ring{ flex-shrink:0; width:56px; height:56px; }
.sh-ring svg{ width:100%; height:100%; transform:rotate(-90deg); }
.sh-ring circle{ fill:none; stroke-width:6; }
.sh-ring-track{ stroke:var(--panel-border); }
.sh-ring-fill{ stroke:var(--accent); stroke-linecap:round; transition:stroke-dasharray 1.1s cubic-bezier(.2,.7,.2,1); }
.sh-progress-text{ flex:1; min-width:0; }
.sh-progress-count{ font-family:var(--font-display); font-size:17px; font-weight:600; line-height:1.3; }
.sh-solved{ color:var(--accent); font-variant-numeric:tabular-nums; }
.sh-progress-note{ color:var(--text-muted); font-size:14px; line-height:1.45; margin-top:2px; }
.sh-continue{
  flex-shrink:0; font-family:var(--font-display); font-weight:600; font-size:14.5px;
  padding:10px 16px; border-radius:8px; border:1px solid var(--accent); color:var(--accent);
  transition:background-color .15s, color .15s;
}
.sh-continue:hover{ background:var(--accent); color:var(--bg); }

/* ---------- Due for review ---------- */
.sh-review{
  margin-bottom:28px; padding:16px 18px; border:1px solid var(--panel-border); border-radius:12px;
  background:linear-gradient(100deg, color-mix(in srgb, var(--h-sys) 6%, var(--panel)), var(--panel) 55%);
}
.sh-review-title{ font-family:var(--font-display); font-size:14px; font-weight:600; color:var(--text-muted); margin-bottom:10px; letter-spacing:.01em; }
.sh-review-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:8px; }
.sh-review-list li{
  display:flex; align-items:baseline; justify-content:space-between; gap:12px; font-size:14.5px;
}
.sh-review-list li a{ font-family:var(--font-display); font-weight:600; color:var(--text); min-width:0; }
.sh-review-list li a:hover{ color:var(--h-sys); text-decoration:underline; }
.sh-review-when{ flex-shrink:0; font-family:var(--font-mono); font-size:12px; color:var(--text-dim); }
.sh-review-list li.is-overdue .sh-review-when{ color:var(--h-db); font-weight:600; }
.sh-review-more{ font-family:var(--font-mono); font-size:12.5px; color:var(--text-dim); }
.sh-review-empty{ color:var(--text-muted); font-size:14px; line-height:1.5; margin:0; }
@media (max-width:720px){
  .sh-review{ padding:16px; }
  .sh-review-list li{ flex-wrap:wrap; }
}

/* ---------- Area cards ---------- */
.sh-grid{ display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:16px; }
.sh-card{
  position:relative; display:flex; flex-direction:column; overflow:hidden;
  border:1px solid var(--panel-border); background:var(--panel); border-radius:12px; padding:24px;
  transition:border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
/* tinted wash from the icon corner, strengthened on hover */
.sh-card::before{
  content:""; position:absolute; inset:0; pointer-events:none; opacity:.55; transition:opacity .25s ease;
  background:radial-gradient(260px circle at 0 0, color-mix(in srgb, var(--h) 12%, transparent), transparent 70%);
}
.sh-card > *{ position:relative; }
.sh-card:hover, .sh-card:focus-visible{
  border-color:color-mix(in srgb, var(--h) 60%, var(--panel-border));
  transform:translateY(-3px);
  box-shadow:0 14px 30px -18px color-mix(in srgb, var(--h) 55%, transparent);
}
.sh-card:hover::before, .sh-card:focus-visible::before{ opacity:1; }
.sh-card:focus-visible{ outline-color:var(--h); border-radius:12px; }

.sh-icon{
  display:grid; place-items:center; width:40px; height:40px; margin-bottom:18px; border-radius:10px;
  color:var(--h); background:color-mix(in srgb, var(--h) 12%, transparent);
  border:1px solid color-mix(in srgb, var(--h) 28%, transparent);
  transition:transform .25s ease;
}
.sh-icon svg{ width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.sh-card:hover .sh-icon, .sh-card:focus-visible .sh-icon{ transform:rotate(-6deg) scale(1.06); }

.sh-card-title{ font-family:var(--font-display); font-size:21px; font-weight:600; line-height:1.25; margin-bottom:8px; letter-spacing:-.01em; }
.sh-card-desc{ color:var(--text-muted); font-size:14.5px; line-height:1.55; margin-bottom:22px; }
.sh-card-stat{ margin-top:auto; font-family:var(--font-mono); font-size:12px; color:var(--h); }

/* DSA: the largest area gets two columns and a larger title */
.sh-card-wide{ grid-column:span 2; }
.sh-card-wide .sh-card-title{ font-size:clamp(28px, 4vw, 36px); letter-spacing:-.02em; }
.sh-card-wide .sh-card-desc{ font-size:15.5px; max-width:calc(100% - 250px); }
.sh-card-wide::before{ background:radial-gradient(420px circle at 0 0, color-mix(in srgb, var(--h) 14%, transparent), transparent 70%); }

/* one dot per problem; solved ones are lit by study-home.js */
.sh-dots{
  position:absolute; right:26px; top:50%; transform:translateY(-50%);
  display:grid; grid-template-columns:repeat(15, 7px); gap:7px;
}
.sh-dots i{ width:7px; height:7px; border-radius:2px; background:color-mix(in srgb, var(--h) 16%, var(--panel-border)); }
.sh-dots i.on{ background:var(--h); box-shadow:0 0 6px color-mix(in srgb, var(--h) 60%, transparent); }
@media (prefers-reduced-motion: no-preference){
  .sh-dots i.on{ animation:sh-pop .35s cubic-bezier(.3,1.5,.5,1) both; animation-delay:calc(.3s + var(--d) * 12ms); }
}
@media (max-width:900px){ .sh-dots{ display:none; } .sh-card-wide .sh-card-desc{ max-width:none; } }

/* System Design: one topic, so a single slim row */
.sh-card-slim{ grid-column:1 / -1; flex-direction:row; align-items:center; gap:18px; padding:18px 24px; }
.sh-card-slim .sh-icon{ margin:0; }
.sh-card-slim .sh-card-title{ margin:0; font-size:19px; white-space:nowrap; }
.sh-card-slim .sh-card-desc{ margin:0; flex:1; }
.sh-card-slim .sh-card-stat{ margin:0; }

/* ---------- Load motion (CSS only; content is never hidden) ---------- */
@media (prefers-reduced-motion: no-preference){
  .sh-edges line{ stroke-dasharray:1; stroke-dashoffset:0; animation:sh-draw .7s cubic-bezier(.3,.6,.3,1) both; }
  .sh-edges line.d1{ animation-delay:.25s; }
  .sh-edges line.d2{ animation-delay:.85s; }
  .sh-edges line.x{ animation:sh-fade .6s 1.4s both; }
  .sh-root-dot, .sh-root-halo{ transform-box:fill-box; transform-origin:center; animation:sh-pop .5s cubic-bezier(.3,1.5,.5,1) both; }
  .sh-node .dot{ transform-box:fill-box; transform-origin:center; animation:sh-pop .45s cubic-bezier(.3,1.5,.5,1) both; animation-delay:calc(.75s + var(--i) * .07s); }
  .sh-leaves circle{ transform-box:fill-box; transform-origin:center; animation:sh-pop .4s cubic-bezier(.3,1.5,.5,1) 1.35s both; }
  /* ambient: the area nodes breathe one after another, like a slow BFS sweep */
  .sh-node .halo{ animation:sh-breathe 7.2s ease-in-out infinite; animation-delay:calc(1.8s + var(--i) * 1.2s); }
  .sh-node.is-hot .halo{ animation:none; }
  .sh-root-halo{ animation:sh-pop .5s cubic-bezier(.3,1.5,.5,1) both, sh-breathe 7.2s ease-in-out 1.2s infinite; }
}
@keyframes sh-draw{ from{ stroke-dashoffset:1; } to{ stroke-dashoffset:0; } }
@keyframes sh-fade{ from{ opacity:0; } to{ opacity:1; } }
@keyframes sh-pop{ from{ transform:scale(0); } to{ transform:scale(1); } }
@keyframes sh-breathe{
  0%, 22%, 100%{ transform:scale(1); stroke-opacity:.3; }
  9%{ transform:scale(1.45); stroke-opacity:.7; }
}
@media (prefers-reduced-motion: reduce){
  .sh-card, .sh-icon, .sh-ring-fill, .sh-node .halo, .sh-node .dot{ transition:none; }
  .sh-card:hover, .sh-card:focus-visible{ transform:none; }
  .sh-card:hover .sh-icon, .sh-card:focus-visible .sh-icon{ transform:none; }
}

/* ---------- Responsive ---------- */
@media (max-width:900px){
  .sh-hero{ grid-template-columns:minmax(0,1fr) 260px; gap:20px; }
}
@media (max-width:720px){
  .sh-wrap{ padding:48px 16px 80px; }
  .sh-hero{ grid-template-columns:1fr; }
  /* the map sits behind the title, top right, as texture */
  .sh-map{ position:absolute; z-index:-1; top:-52px; right:-16px; width:190px; opacity:.5; }
  .sh-hero::before{ inset:-50px -16px auto 30%; height:260px; }
  .sh-lede{ font-size:15.5px; }
  .sh-grid{ grid-template-columns:1fr; gap:12px; }
  .sh-card-wide, .sh-card-slim{ grid-column:auto; }
  .sh-card{ padding:20px; }
  .sh-card-slim{ flex-direction:column; align-items:flex-start; gap:0; padding:20px; }
  .sh-card-slim .sh-icon{ margin-bottom:18px; }
  .sh-card-slim .sh-card-title{ margin-bottom:8px; }
  .sh-card-slim .sh-card-desc{ margin-bottom:22px; }
  .sh-progress{ flex-wrap:wrap; gap:14px; padding:16px; }
  .sh-continue{ width:100%; text-align:center; }
}
