/* Arfi Academy — product styles. Requires ../tokens.css and ../kit.css */

html, body { overflow-x: clip; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mono, code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }

/* Header */
.top__in { gap: 1.5rem; }
.hsearch { position: relative; width: 260px; }
.hsearch .ic { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); }
.hsearch input { width: 100%; height: 38px; padding: 0 .8rem 0 2.25rem; border-radius: var(--r-sm); background: var(--card); border: 1px solid var(--line); outline: 0; font-size: var(--fs-sm); }
.hsearch input:focus { border-color: var(--gold-500); }
.hsearch input::placeholder { color: var(--faint); }
.top__link { display: inline-flex; align-items: center; gap: .35rem; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); padding: .4rem .5rem; white-space: nowrap; }
.top__link:hover { color: var(--gold-400); }
.top__link .ic { width: 14px; height: 14px; }
.drop--wide { min-width: 260px; }
.drop a small { display: block; font-size: var(--fs-xs); color: var(--faint); }

/* Shared bits */
.lvl { font-size: var(--fs-xs); font-weight: 700; display: inline-flex; align-items: center; gap: .35rem; }
.lvl::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.lvl--b { color: var(--up); }
.lvl--i { color: var(--warn); }
.lvl--a { color: var(--down); }
.topic { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-400); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .9rem; font-size: var(--fs-xs); color: var(--muted); }
.meta span { display: inline-flex; align-items: center; gap: .3rem; }
.meta .ic { width: 13px; height: 13px; }
.sec { padding: 4rem 0 0; }
.sec__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem 2rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.sec__head h2 { font-size: 1.65rem; letter-spacing: -.01em; margin-top: .35rem; }
.sec__head p { color: var(--muted); font-size: var(--fs-sm); max-width: 520px; }
.more { display: inline-flex; align-items: center; gap: .35rem; font-size: var(--fs-sm); font-weight: 700; color: var(--gold-400); }
.more .ic { width: 15px; height: 15px; }
.more:hover { color: var(--gold-300); }

/* Art frames (abstract SVG) */
.art { position: relative; display: block; overflow: hidden; background: var(--bg-2); color: var(--gold-400); }
.art::after { content: ""; position: absolute; inset: 0; background: radial-gradient(70% 90% at 80% 10%, var(--gold-soft), transparent 70%); pointer-events: none; }
.art svg { width: 100%; height: 100%; }
.art--alt::after { background: radial-gradient(70% 90% at 15% 100%, var(--gold-soft), transparent 70%); }
.art--up { color: var(--up); }
.art--up::after { background: radial-gradient(70% 90% at 80% 10%, var(--up-soft), transparent 70%); }
.art--warn { color: var(--warn); }
.art--warn::after { background: radial-gradient(70% 90% at 80% 10%, var(--warn-soft), transparent 70%); }
.art--down { color: var(--down); }
.art--down::after { background: radial-gradient(70% 90% at 80% 10%, var(--down-soft), transparent 70%); }

/* Hero */
.hero { padding: 3.5rem 0 3rem; border-bottom: 1px solid var(--line-soft); }
.hero__grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 3.5rem; align-items: center; }
.hero h1 { font-size: clamp(2.2rem, 4.4vw, 3.4rem); line-height: 1.08; letter-spacing: -.02em; margin: .8rem 0 1rem; }
.hero h1 em { font-style: normal; color: var(--gold-400); }
.hero__lead { font-size: var(--fs-lead); color: var(--text-2); max-width: 520px; }
.hero__search { position: relative; margin-top: 2rem; max-width: 520px; }
.hero__search .ic { position: absolute; left: 1.1rem; top: 50%; transform: translateY(-50%); color: var(--faint); }
.hero__search .input { height: 56px; padding-left: 3rem; padding-right: 7.5rem; background: var(--surface); }
.hero__search .btn { position: absolute; right: 6px; top: 6px; height: 44px; }
.trust { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-top: 1.25rem; font-size: var(--fs-sm); color: var(--muted); }
.trust span { display: inline-flex; align-items: center; gap: .4rem; }
.trust .ic { width: 15px; height: 15px; color: var(--up); }

.feat { display: grid; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-xl); overflow: hidden; transition: border-color .2s; }
.feat:hover { border-color: var(--gold-600); }
.feat .art { aspect-ratio: 16 / 7.2; border-bottom: 1px solid var(--line-soft); }
.feat__body { padding: 1.5rem 1.6rem 1.6rem; display: grid; gap: .7rem; }
.feat__tags { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.feat h2 { font-size: 1.55rem; line-height: 1.2; letter-spacing: -.01em; }
.feat:hover h2 { color: var(--gold-300); }
.feat p { color: var(--muted); font-size: var(--fs-sm); }
.feat__badge { position: absolute; z-index: 1; left: 1rem; top: 1rem; }

/* Tracks */
.track { display: flex; flex-direction: column; gap: .9rem; padding: 1.5rem; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-soft); }
.track__top { display: flex; align-items: center; justify-content: space-between; }
.track h3 { font-size: 1.15rem; }
.track > p { color: var(--muted); font-size: var(--fs-sm); }
.track ol { margin: 0; padding: 0; list-style: none; counter-reset: t; display: grid; gap: .1rem; flex: 1; }
.track li { counter-increment: t; display: flex; gap: .75rem; align-items: center; padding: .55rem 0; border-top: 1px solid var(--line-soft); font-size: var(--fs-sm); color: var(--text-2); }
.track li::before { content: counter(t, decimal-leading-zero); font-size: var(--fs-xs); font-weight: 700; color: var(--faint); font-variant-numeric: tabular-nums; }
.track li a:hover { color: var(--gold-400); }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; align-items: center; justify-content: space-between; padding: .75rem; margin-bottom: 1.5rem; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line-soft); }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chips button { padding: .4rem .85rem; border-radius: 999px; border: 1px solid var(--line); background: none; color: var(--muted); font-size: var(--fs-xs); font-weight: 700; cursor: pointer; }
.chips button:hover { color: var(--text); }
.chips button.is-on { background: var(--gold-soft); border-color: var(--gold-600); color: var(--gold-400); }
.filters__count { font-size: var(--fs-xs); color: var(--faint); margin-left: auto; }
.filters .seg button { white-space: nowrap; flex: none; }

/* Article cards */
.agrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.acard { display: flex; flex-direction: column; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-soft); overflow: hidden; transition: border-color .2s, transform .2s var(--ease); }
.acard:hover { border-color: var(--gold-600); transform: translateY(-2px); }
.acard:hover h3 { color: var(--gold-300); }
.acard .art { aspect-ratio: 16 / 8; border-bottom: 1px solid var(--line-soft); }
.acard__body { padding: 1.15rem 1.25rem 1.25rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.acard__tags { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.acard h3 { font-size: 1.05rem; line-height: 1.3; }
.acard p { color: var(--muted); font-size: var(--fs-sm); flex: 1; }
.acard .meta { padding-top: .5rem; }
.acard[hidden] { display: none; }
.agrid__empty { grid-column: 1 / -1; }

/* Tutorials row */
.tuts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--r-lg); overflow: hidden; }
.tut { display: flex; flex-direction: column; gap: .5rem; padding: 1.25rem; background: var(--surface); }
.tut:hover { background: var(--card); }
.tut:hover b { color: var(--gold-400); }
.tut__n { font-size: var(--fs-xs); font-weight: 800; color: var(--gold-400); font-variant-numeric: tabular-nums; }
.tut b { font-size: .98rem; }
.tut small { font-size: var(--fs-sm); color: var(--muted); }

/* Glossary */
.gloss { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 2rem; align-items: start; }
.gloss__side { position: sticky; top: 84px; display: grid; gap: 1rem; }
.gloss__side .input { height: 42px; }
.az { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.az button { height: 30px; border-radius: 6px; border: 1px solid var(--line-soft); background: var(--surface); color: var(--text-2); font-size: var(--fs-xs); font-weight: 700; cursor: pointer; }
.az button:hover { border-color: var(--gold-600); color: var(--gold-400); }
.az button.is-on { background: var(--gold-400); color: var(--gold-ink); border-color: var(--gold-400); }
.az button[disabled] { color: var(--faint); background: none; cursor: default; border-color: transparent; }
.terms { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 2rem; }
.term { padding: 1.1rem 0; border-bottom: 1px solid var(--line-soft); }
.term dt { display: flex; align-items: center; gap: .6rem; font-weight: 700; }
.term dt .lvl { margin-left: auto; }
.term dd { margin: .35rem 0 0; color: var(--muted); font-size: var(--fs-sm); line-height: 1.6; }
.term[hidden] { display: none; }

.soon { display: flex; gap: 1rem; padding: 1.25rem; border-radius: var(--r-lg); border: 1px dashed var(--line); }
.soon h3 { font-size: 1rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.soon p { color: var(--muted); font-size: var(--fs-sm); margin-top: .25rem; }
.soon > .ic { color: var(--muted); width: 22px; height: 22px; }
.risk { margin-top: 3rem; }

/* Article page */
.progress { position: fixed; z-index: 60; top: 0; left: 0; height: 2px; width: 0; background: var(--gold-grad); }
.ahero { padding: 2.25rem 0 0; }
.crumbs { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; font-size: var(--fs-xs); color: var(--muted); }
.crumbs .ic { width: 12px; height: 12px; color: var(--faint); }
.crumbs a:hover { color: var(--gold-400); }
.ahero__tags { display: flex; gap: .6rem; align-items: center; margin-top: 1.5rem; flex-wrap: wrap; }
.ahero h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1; letter-spacing: -.02em; margin: .9rem 0 1rem; max-width: 900px; }
.ahero__lead { font-size: var(--fs-lead); color: var(--text-2); max-width: 780px; }
.byline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.75rem; padding: 1rem 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.author { display: flex; align-items: center; gap: .8rem; }
.author__av { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--card); border: 1px solid var(--line); }
.author__av svg { width: 24px; height: 24px; }
.author b { display: block; font-size: var(--fs-sm); }
.author small { display: block; font-size: var(--fs-xs); color: var(--muted); }
.byline__r { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.ahero .art { margin-top: 2rem; border-radius: var(--r-xl); border: 1px solid var(--line-soft); aspect-ratio: 1200 / 420; }
.ahero figcaption { font-size: var(--fs-xs); color: var(--faint); margin-top: .6rem; }
.ahero figure { margin: 0; }

.alayout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 4rem; align-items: start; padding-top: 2.5rem; }
.prose { max-width: 740px; min-width: 0; }
.prose h2 { font-size: 1.55rem; letter-spacing: -.01em; margin: 2.75rem 0 1rem; scroll-margin-top: 90px; }
.prose h3 { font-size: 1.15rem; margin: 2rem 0 .75rem; scroll-margin-top: 90px; }
.prose p { color: var(--text-2); font-size: 1.05rem; line-height: 1.8; margin-bottom: 1.15rem; }
.prose p b, .prose li b { color: var(--text); }
.prose ul, .prose ol { color: var(--text-2); font-size: 1.05rem; line-height: 1.75; padding-left: 1.3rem; margin: 0 0 1.15rem; }
.prose li + li { margin-top: .4rem; }
.prose li::marker { color: var(--gold-500); }
.prose code { padding: .1rem .38rem; border-radius: 5px; background: var(--card); border: 1px solid var(--line-soft); font-size: .86em; color: var(--gold-300); }
.prose .note { margin: 1.5rem 0; font-size: var(--fs-sm); line-height: 1.65; }
.prose .note .ic { margin-top: .1rem; }
.note__t { display: block; color: var(--text); font-weight: 700; margin-bottom: .2rem; }
.gterm { border-bottom: 1px dashed var(--gold-600); color: var(--text); cursor: help; }

.takeaways { padding: 1.5rem 1.6rem; border-radius: var(--r-lg); background: linear-gradient(180deg, var(--gold-soft), transparent 140%), var(--surface); border: 1px solid var(--gold-600); }
.takeaways h2 { margin: 0 0 1rem !important; font-size: 1.05rem !important; display: flex; align-items: center; gap: .5rem; color: var(--gold-400); }
.takeaways ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.takeaways li { display: flex; gap: .75rem; font-size: 1rem; line-height: 1.6; margin: 0 !important; }
.takeaways li .ic { color: var(--gold-400); margin-top: .25rem; width: 16px; height: 16px; }

.cmp { margin: 1.5rem 0; }
.cmp td { white-space: normal; min-width: 150px; vertical-align: top; line-height: 1.5; }
.cmp td:first-child { color: var(--muted); min-width: 120px; }
.cmp th.is-arfi, .cmp td.is-arfi { background: var(--gold-soft); }
.cmp th.is-arfi { color: var(--gold-400); }

.rot { margin: 1.5rem 0; padding: 1.25rem; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-soft); }
.rot__legend { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; font-size: var(--fs-xs); color: var(--muted); margin-bottom: 1rem; }
.rot__legend span { display: inline-flex; align-items: center; gap: .4rem; }
.rot__legend i { width: 10px; height: 10px; border-radius: 3px; border: 1px solid var(--line); }
.rot__legend i.in { background: var(--gold-soft); border-color: var(--gold-500); }
.rot__legend i.out { background: var(--warn-soft); border-color: var(--warn); border-style: dashed; }
.rot__legend i.off { background: var(--down-soft); border-color: var(--down); }
.rot__scroll { overflow-x: auto; padding-bottom: .25rem; }
.rot__row { display: grid; grid-template-columns: repeat(6, minmax(96px, 1fr)); gap: .6rem; min-width: 620px; position: relative; }
.blk { position: relative; padding: .75rem; border-radius: var(--r-md); border: 1px solid var(--gold-500); background: var(--gold-soft); display: grid; gap: .3rem; }
.blk + .blk::before { content: ""; position: absolute; left: calc(-.6rem - 1px); top: 50%; width: .6rem; height: 1px; background: var(--line); }
.blk--out { border-color: var(--warn); border-style: dashed; background: var(--warn-soft); }
.blk__n { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.blk b { font-size: 1rem; }
.blk small { font-size: 11px; color: var(--text-2); }
.rot__val { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-top: 1rem; }
.val { display: flex; align-items: center; gap: .6rem; padding: .6rem .75rem; border-radius: var(--r-sm); background: var(--bg-2); border: 1px solid var(--line-soft); font-size: var(--fs-xs); color: var(--text-2); }
.val b { color: var(--text); }
.val--off { border-color: var(--down); border-style: dashed; }
.rot figcaption { font-size: var(--fs-xs); color: var(--faint); margin-top: 1rem; line-height: 1.6; }

.share { display: flex; gap: .5rem; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--card); color: var(--text-2); cursor: pointer; }
.icon-btn:hover { color: var(--gold-400); border-color: var(--gold-600); }
.icon-btn .ic { width: 16px; height: 16px; }

.arail { position: sticky; top: 84px; display: grid; gap: 1.25rem; }
.atoc h4, .rail-card h4 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: .75rem; }
.atoc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line-soft); counter-reset: c; }
.atoc a { counter-increment: c; display: flex; gap: .6rem; padding: .38rem 0 .38rem .9rem; margin-left: -1px; border-left: 2px solid transparent; font-size: var(--fs-sm); color: var(--muted); line-height: 1.4; }
.atoc a::before { content: counter(c, decimal-leading-zero); font-size: var(--fs-xs); color: var(--faint); padding-top: .1rem; font-variant-numeric: tabular-nums; }
.atoc a:hover { color: var(--text); }
.atoc a.is-on { color: var(--gold-400); border-left-color: var(--gold-400); }
.atoc a.is-on::before { color: var(--gold-500); }
.rail-card { padding: 1.1rem 1.25rem; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line-soft); }
.rail-card dl { margin: 0; display: grid; gap: .75rem; }
.rail-card dt { font-size: var(--fs-sm); font-weight: 700; }
.rail-card dd { margin: .15rem 0 0; font-size: var(--fs-xs); color: var(--muted); line-height: 1.55; }
.mtoc { display: none; }

.endnote { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line-soft); display: grid; gap: 1rem; }
.sources { font-size: var(--fs-sm); color: var(--muted); }
.sources b { display: block; color: var(--text-2); margin-bottom: .4rem; }
.sources a { color: var(--gold-400); }
.sources a:hover { text-decoration: underline; }
.sources ul { margin: 0; padding-left: 1.1rem; display: grid; gap: .25rem; }

/* Footer */
.foot__cols { display: grid; grid-template-columns: repeat(3, minmax(130px, 1fr)); gap: 2rem; }
.foot__cols h4 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); margin-bottom: .7rem; }
.foot__cols a { display: block; font-size: var(--fs-sm); color: var(--muted); padding: .2rem 0; }
.foot__cols a:hover { color: var(--gold-400); }

/* Responsive */
@media (max-width: 1180px) {
  .alayout { grid-template-columns: minmax(0, 1fr) 260px; gap: 2.5rem; }
  .hsearch { width: 200px; }
}
@media (max-width: 1080px) {
  .hero__grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .agrid { grid-template-columns: repeat(2, 1fr); }
  .tuts { grid-template-columns: repeat(2, 1fr); }
  .top__link { display: none; }
}
@media (max-width: 900px) {
  .hsearch { display: none; }
  .alayout { grid-template-columns: minmax(0, 1fr); padding-top: 1.5rem; }
  .arail { display: none; }
  .mtoc { display: block; margin-bottom: 1.5rem; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line-soft); }
  .mtoc summary { list-style: none; display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.1rem; font-weight: 700; font-size: var(--fs-sm); cursor: pointer; }
  .mtoc summary::-webkit-details-marker { display: none; }
  .mtoc summary .ic { width: 14px; height: 14px; transition: transform .15s; color: var(--muted); }
  .mtoc[open] summary .ic { transform: rotate(90deg); }
  .mtoc ol { margin: 0; padding: 0 1.1rem 1rem 2.4rem; display: grid; gap: .45rem; font-size: var(--fs-sm); color: var(--muted); }
  .mtoc a:hover { color: var(--gold-400); }
  .gloss { grid-template-columns: 1fr; gap: 1.25rem; }
  .gloss__side { position: static; }
  .az { grid-template-columns: repeat(13, 1fr); }
}
@media (max-width: 640px) {
  .hero { padding: 2.5rem 0 2.5rem; }
  .agrid, .tuts, .terms { grid-template-columns: 1fr; }
  .az { grid-template-columns: repeat(9, 1fr); }
  .feat h2 { font-size: 1.3rem; }
  .feat .art { aspect-ratio: 16 / 9; }
  .prose p, .prose ul, .prose ol { font-size: 1rem; }
  .prose h2 { font-size: 1.3rem; }
  .rot__val { grid-template-columns: 1fr; }
  .filters { padding: .6rem; }
  .filters .seg { width: 100%; overflow-x: auto; }
  .filters__count { margin-left: 0; }
  .hero__search .input { padding-right: 1rem; }
  .hero__search .btn { display: none; }
  .foot__cols { grid-template-columns: 1fr 1fr; }
}
