/* ==========================================================================
   ActiveVitPH — guides
   The index shelf, and the reading layout for a single guide.
   ========================================================================== */

/* ================================================== shared page opening === */

.gpage {
  position: relative;
  padding-top: 118px;
  overflow: clip;
}

.gpage__glow {
  position: absolute;
  top: -260px;
  left: 50%;
  width: min(1100px, 130vw);
  height: 620px;
  translate: -50% 0;
  opacity: 0.5;
  pointer-events: none;
}

.gpage__mesh {
  position: absolute;
  inset: 0 0 auto;
  height: 640px;
  opacity: 0.5;
  pointer-events: none;
}

.gpage > .shell { position: relative; z-index: 1; }

/* Small "back to" link that sits above every interior page title. */
.gback {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  transition: color var(--t-mid) var(--ease-out), gap var(--t-mid) var(--ease-out);
}

.gback:hover { color: var(--brass); gap: 0.85em; }
.gback span { transition: transform var(--t-mid) var(--ease-out); }
.gback:hover span { transform: translateX(-3px); }

/* ============================================== index: the guide shelf === */

.ghead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 40px;
  padding: 34px 0 46px;
}

.ghead h1 { margin: 18px 0 20px; }
.ghead p { max-width: 34em; }

.ghead__count {
  text-align: right;
  font-family: var(--font-mono);
  line-height: 1.2;
}

.ghead__count b {
  display: block;
  font-size: clamp(2.6rem, 6vw, 4rem);
  font-weight: 500;
  color: var(--brass);
  letter-spacing: -0.05em;
}

.ghead__count span {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* The shelf is deliberately uneven: the first entry is a wide feature, the
   rest fall into a two-column run underneath it. */
.gshelf {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding-bottom: 96px;
}

/* A run of cards is broken into named groups. The heading spans the grid so
   the cards below it stay on the same two-column rhythm. */
.gshelf__group {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin: 40px 0 4px;
}

.gshelf__group:first-child { margin-top: 0; }

.gshelf__group h2 {
  font-family: var(--font-display);
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex: none;
}

.gshelf__group p {
  font-size: 0.86rem;
  color: var(--text-4);
  margin: 0;
}

.gshelf__group::after {
  content: "";
  flex: 1;
  height: 1px;
  min-width: 24px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}

@media (max-width: 720px) {
  .gshelf__group { flex-direction: column; gap: 6px; }
  .gshelf__group::after { display: none; }
}

.gcard {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  padding: 30px 30px 26px;
  border-radius: var(--r-lg);
  background: linear-gradient(168deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.012));
  border: 1px solid var(--line);
  box-shadow: var(--sh-1), var(--sh-inset);
  overflow: hidden;
  isolation: isolate;
  transition:
    transform var(--t-mid) var(--ease-out),
    border-color var(--t-mid) var(--ease-out),
    box-shadow var(--t-mid) var(--ease-out);
}

.gcard::after {
  content: "";
  position: absolute;
  inset: -1px -1px auto;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(230, 174, 93, 0.55), transparent);
  opacity: 0;
  transition: opacity var(--t-mid) var(--ease-out);
}

.gcard:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: var(--sh-3), var(--sh-inset);
}

.gcard:hover::after { opacity: 1; }

/* The feature entry spans the row and carries its own artwork. */
.gcard--lead {
  grid-column: 1 / -1;
  grid-template-rows: auto;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: center;
  gap: 34px;
  padding: 44px 44px 40px;
  background:
    radial-gradient(90% 130% at 88% 40%, rgba(230, 174, 93, 0.11), transparent 62%),
    linear-gradient(168deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.014));
}

.gcard--lead .gcard__body { display: grid; gap: 16px; align-content: start; }
.gcard--lead h3 { font-size: clamp(1.5rem, 2.8vw, 2.1rem); letter-spacing: -0.03em; }

.gcard__art {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 148px;
  padding: 8px 0 4px;
}

/* The diagrams are drawn at their natural size; letting them stretch to the
   card width turns a small illustration into wallpaper. */
.gcard__art svg {
  width: auto;
  max-width: min(100%, 188px);
  max-height: 150px;
  height: auto;
  overflow: visible;
}

.gcard--lead .gcard__art { min-height: 0; padding: 0; }

.gcard--lead .gcard__art svg {
  max-width: min(100%, 310px);
  max-height: none;
}

.gcard__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.gcard h3 {
  font-size: 1.24rem;
  letter-spacing: -0.02em;
}

.gcard h3 a::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
}

.gcard p {
  color: var(--text-2);
  font-size: 0.94rem;
  text-wrap: pretty;
}

.gcard__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.gcard__go {
  color: var(--brass);
  transition: transform var(--t-mid) var(--ease-out);
}

.gcard:hover .gcard__go { transform: translateX(4px); }

@media (max-width: 900px) {
  .gshelf { grid-template-columns: minmax(0, 1fr); }
  .gcard--lead { grid-template-columns: minmax(0, 1fr); padding: 32px 28px 28px; }
  .gcard--lead .gcard__art { order: -1; max-width: 320px; }
  .ghead { grid-template-columns: minmax(0, 1fr); align-items: start; gap: 22px; }
  .ghead__count { text-align: left; }
}

/* ================================================== a single guide page === */

.gtop { padding: 34px 0 40px; }

.gtop__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 20px;
}

.gtop h1 {
  font-size: clamp(2.1rem, 4.6vw, 3.4rem);
  letter-spacing: -0.035em;
  line-height: 1.03;
  max-width: 17em;
  margin-bottom: 20px;
}

.gtop__lead {
  font-size: clamp(1.04rem, 1.6vw, 1.22rem);
  line-height: 1.6;
  color: var(--text-2);
  max-width: 40em;
  text-wrap: pretty;
}

.gtop__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.gtop__meta b { color: var(--text-2); font-weight: 500; }

/* --- the reading column and its rail ------------------------------------ */

.glayout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: clamp(32px, 5vw, 76px);
  align-items: start;
  padding-bottom: 100px;
}

.grail { position: sticky; top: 104px; }

.grail__label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-4);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 14px;
}

.grail ol { display: grid; gap: 2px; counter-reset: toc; }

.grail a {
  display: block;
  position: relative;
  padding: 7px 0 7px 26px;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text-3);
  transition: color var(--t-mid) var(--ease-out);
}

.grail a::before {
  counter-increment: toc;
  content: counter(toc, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 7px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-4);
  transition: color var(--t-mid) var(--ease-out);
}

.grail a:hover,
.grail a.is-here { color: var(--text); }
.grail a:hover::before,
.grail a.is-here::before { color: var(--brass); }

/* --- prose -------------------------------------------------------------- */

.prose {
  max-width: 68ch;
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--text-2);
}

.prose > * + * { margin-top: 1.15em; }

.prose h2 {
  font-size: clamp(1.42rem, 2.5vw, 1.85rem);
  letter-spacing: -0.028em;
  color: var(--text);
  margin-top: 2.6em;
  scroll-margin-top: 100px;
}

.prose h2:first-child { margin-top: 0; }

.prose h3 {
  font-size: 1.1rem;
  letter-spacing: -0.018em;
  color: var(--text);
  margin-top: 2em;
}

.prose strong { color: var(--text); font-weight: 600; }
.prose em { color: var(--text); font-style: italic; }

.prose a:not(.btn) {
  color: var(--brass);
  text-decoration: underline;
  text-decoration-color: rgba(230, 174, 93, 0.35);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--t-mid) var(--ease-out);
}

.prose a:not(.btn):hover { text-decoration-color: var(--brass); }

.prose ul,
.prose ol {
  display: grid;
  gap: 0.6em;
  padding-left: 1.5em;
}

.prose ul li { position: relative; list-style: none; }

.prose ul li::before {
  content: "";
  position: absolute;
  left: -1.15em;
  top: 0.72em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brass-deep);
}

.prose ol { list-style: decimal; counter-reset: none; }
.prose ol li { list-style: decimal; padding-left: 0.2em; }
.prose ol li::marker {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--brass-deep);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 0.15em 0.42em;
  border-radius: var(--r-xs);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line-soft);
  color: var(--brass-hi);
}

/* --- figures ------------------------------------------------------------ */

/* Diagrams, and the two blocks that close the page, run wider than the
   reading column. The text keeps a hard left edge and the figures lean into
   the space on the right rather than leaving it empty. */
.fig,
.gtry,
.gnext {
  width: min(126%, 830px);
}

.fig {
  margin-top: 2.2em;
  margin-bottom: 2.2em;
}

.fig__frame {
  position: relative;
  padding: clamp(20px, 3vw, 34px);
  border-radius: var(--r-lg);
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(255, 255, 255, 0.05), transparent 68%),
    linear-gradient(170deg, var(--ink-900), var(--ink-1000));
  border: 1px solid var(--line);
  box-shadow: var(--sh-2), var(--sh-inset);
  overflow: hidden;
}

.fig__frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(80% 70% at 50% 40%, #000, transparent 85%);
  pointer-events: none;
}

.fig__frame > * { position: relative; }
.fig svg { width: 100%; height: auto; overflow: visible; }

.fig figcaption {
  margin-top: 14px;
  padding-left: 16px;
  border-left: 2px solid rgba(230, 174, 93, 0.4);
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--text-3);
  text-wrap: pretty;
}

.fig figcaption b { color: var(--text-2); font-weight: 600; }

/* Two or three diagrams that belong side by side. */
.fig__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: clamp(14px, 2vw, 24px);
  align-items: start;
}

/* Diagrams of a single long line stay readable stacked, not side by side. */
.fig__row--stack { grid-template-columns: minmax(0, 1fr); gap: 20px; }

.fig__cell { display: grid; gap: 10px; }

.fig__cell > figcaption,
.fig__tag {
  margin: 0;
  padding: 0;
  border: 0;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  text-align: center;
}

.fig__tag--good { color: var(--good); }
.fig__tag--bad { color: var(--bad); }

/* --- callouts ----------------------------------------------------------- */

.note {
  position: relative;
  margin: 2.2em 0;
  padding: 24px 28px 24px 30px;
  border-radius: var(--r-md);
  background: linear-gradient(150deg, rgba(230, 174, 93, 0.075), rgba(230, 174, 93, 0.015));
  border: 1px solid rgba(230, 174, 93, 0.2);
  color: var(--text-2);
}

.note::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(to bottom, var(--brass), transparent);
}

.note h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--brass-hi);
}

.note > * + * { margin-top: 0.8em; }
.note p { margin: 0; }

.note--teal {
  background: linear-gradient(150deg, rgba(90, 211, 204, 0.07), rgba(90, 211, 204, 0.012));
  border-color: rgba(90, 211, 204, 0.2);
}

.note--teal::before { background: linear-gradient(to bottom, var(--teal), transparent); }
.note--teal h3 { color: var(--teal); }

/* A short list of rules or steps, numbered in the accent. */
.steps {
  display: grid;
  gap: 2px;
  margin: 2em 0;
  counter-reset: step;
}

.steps li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 14px;
  align-items: baseline;
  padding: 15px 18px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.022);
  border: 1px solid var(--line-soft);
}

.steps li::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--brass);
}

.steps b { display: block; color: var(--text); }

/* --- try-it strip and next-guide ---------------------------------------- */

.gtry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin: 3em 0 0;
  padding: 28px 32px;
  border-radius: var(--r-lg);
  background:
    radial-gradient(90% 160% at 92% 50%, rgba(230, 174, 93, 0.12), transparent 60%),
    linear-gradient(160deg, var(--ink-850), var(--ink-950));
  border: 1px solid var(--line);
  box-shadow: var(--sh-2), var(--sh-inset);
}

.gtry h2 { margin: 0 0 4px; font-size: 1.18rem; letter-spacing: -0.02em; color: var(--text); }
.gtry p { margin: 0; font-size: 0.92rem; color: var(--text-3); max-width: 40em; }

.gnext {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 60px;
  padding-top: 34px;
  border-top: 1px solid var(--line-soft);
}

.gnext__label {
  grid-column: 1 / -1;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-4);
}

.gnext a {
  display: grid;
  gap: 6px;
  padding: 20px 22px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.024);
  border: 1px solid var(--line-soft);
  transition:
    background-color var(--t-mid) var(--ease-out),
    border-color var(--t-mid) var(--ease-out),
    transform var(--t-mid) var(--ease-out);
}

.gnext a:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line-strong);
  transform: translateY(-3px);
}

.gnext b {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
}

.gnext span { font-size: 0.85rem; color: var(--text-3); }

@media (max-width: 1180px) {
  .fig,
  .gtry,
  .gnext { width: 100%; }
}

@media (max-width: 940px) {
  .glayout { grid-template-columns: minmax(0, 1fr); gap: 30px; }
  .grail {
    position: static;
    padding: 18px 20px;
    border-radius: var(--r-md);
    background: rgba(255, 255, 255, 0.024);
    border: 1px solid var(--line-soft);
  }
  .grail ol { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .prose { max-width: none; }
}

/* ==================================== plain editorial pages (legal etc) === */

.doc { padding-bottom: 100px; }

.doc__head { padding: 34px 0 40px; }
.doc__head h1 { margin: 20px 0 18px; }
.doc__head p { max-width: 42em; }

.doc__updated {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  margin-top: 24px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.doc__grid {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: clamp(32px, 5vw, 76px);
  align-items: start;
}

@media (max-width: 940px) {
  .doc__grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
}
