/* =========================================================
   Revision notes — shared styles
   Used by every notes section under /resources/:
     /resources/ib-dp/physics/    (IB DP Physics)
     /resources/ib-myp/physics/   (IB MYP Physics / Sciences)
   Extends the neo-brutalist language in /style.css: same
   tokens, same hard offset shadows, same type stack.
   These sections are English-only (IB is examined in English),
   so no data-en/data-id pairs are used on their pages.
   Edit here, not per-section -- there is only one copy.
   ========================================================= */

/* ── Shell: sticky topic rail + article ─────────────────── */
.pw-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 44px;
  align-items: start;
}

/* ── Topic rail ─────────────────────────────────────────── */
.pw-rail {
  position: sticky; top: 84px;
  max-height: calc(100vh - 108px);
  overflow-y: auto;
  background: var(--surface);
  border: var(--bw) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 18px;
  scrollbar-width: thin;
}
.pw-rail-title {
  font-family: 'Archivo Black', 'Space Grotesk', sans-serif;
  font-size: .82rem; text-transform: uppercase; letter-spacing: .04em;
  padding-bottom: 12px; margin-bottom: 12px;
  border-bottom: 2px solid var(--border-soft);
}
.pw-rail-group { margin-bottom: 18px; }
.pw-rail-group:last-child { margin-bottom: 0; }
.pw-rail-group > h4 {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); margin-bottom: 7px;
}
.pw-rail a {
  display: block; padding: 6px 9px; margin-bottom: 2px;
  font-size: .84rem; line-height: 1.35;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  transition: background .12s, border-color .12s;
}
.pw-rail a:hover { background: var(--surface-2); }
.pw-rail a.current {
  background: var(--gold-soft);
  border-color: var(--ink);
  font-weight: 700;
}
.pw-rail a .hl {
  font-size: .64rem; font-weight: 700; letter-spacing: .04em;
  color: var(--gold-deep); vertical-align: 1px; margin-left: 4px;
}

/* Mobile: the rail becomes a disclosure above the article */
.pw-rail-toggle { display: none; }

/* ── Article ────────────────────────────────────────────── */
.pw-article { max-width: 74ch; }
.pw-crumbs {
  font-size: .78rem; color: var(--text-muted);
  margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 6px;
}
.pw-crumbs a { border-bottom: 1px solid var(--border-soft); }
.pw-crumbs a:hover { color: var(--text); border-bottom-color: var(--ink); }

/* Topic masthead */
.pw-masthead {
  border-bottom: var(--bw) solid var(--ink);
  padding-bottom: 22px; margin-bottom: 30px;
}
.pw-code {
  display: inline-block; margin-bottom: 12px;
  background: var(--ink); color: #fff;
  font-family: 'Archivo Black', 'Space Grotesk', sans-serif;
  font-size: .82rem; letter-spacing: .04em;
  padding: 5px 12px; border-radius: var(--radius-sm);
}
.pw-masthead h1 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); margin-bottom: 12px; }
.pw-meta { font-size: .84rem; color: var(--text-muted); font-weight: 500; }
.pw-lede {
  margin-top: 18px; padding: 16px 20px;
  background: var(--surface-2);
  border-left: var(--bw) solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .95rem;
}

/* Section headings inside the article */
.pw-article h2 {
  font-size: 1.28rem; margin: 42px 0 16px;
  display: flex; align-items: center; gap: 10px;
}
.pw-article h2 .ic { font-size: 1.3rem; }
.pw-article h3 { font-size: 1.02rem; margin: 26px 0 10px; }
.pw-article p { margin-bottom: 15px; }
.pw-article strong { font-weight: 700; }
/* <em> is used for the phrases the source italicises for emphasis —
   rendered as a highlight, not a slant, to match the brand. */
.pw-article em {
  font-style: normal; font-weight: 700;
  background: var(--gold-soft); padding: 0 3px; border-radius: 3px;
}

/* ── Blocks ─────────────────────────────────────────────── */
.pw-box {
  border: var(--bw) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px 26px;
  margin: 0 0 20px;
}
.pw-box > h2:first-child, .pw-box > h3:first-child { margin-top: 0; }

.pw-objectives { background: var(--gold-soft); }
.pw-objectives ul { list-style: none; margin-left: 0; }
.pw-objectives li {
  position: relative; padding-left: 30px; margin-bottom: 10px; font-size: .94rem;
}
.pw-objectives li::before {
  content: "\2713"; position: absolute; left: 0; top: -1px;
  font-weight: 700; color: var(--gold-deep); font-size: 1.05rem;
}
.pw-objectives li:last-child { margin-bottom: 0; }
.hl-tag {
  display: inline-block; background: var(--ink); color: #fff;
  font-size: .62rem; font-weight: 700; letter-spacing: .05em;
  padding: 2px 6px; border-radius: 4px; margin-right: 6px; vertical-align: 2px;
}

.pw-worked   { background: var(--surface); }
.pw-see      { background: var(--accent-soft); }
.pw-practise { background: var(--surface-2); }

/* Worked-example question stem */
.pw-question {
  background: var(--surface-2);
  border-left: var(--bw) solid var(--accent);
  padding: 14px 18px; margin-bottom: 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .94rem;
}

/* The named mistake that ends most worked examples */
.pw-trap {
  background: #FFF1F1;
  border: 2px solid #B91C1C;
  border-radius: var(--radius-sm);
  padding: 14px 18px; margin-top: 18px;
  font-size: .92rem;
}
.pw-trap > strong:first-child { color: #B91C1C; }

/* Sanity-check / "what to notice" closer */
.pw-check {
  background: #F0FAF3;
  border: 2px solid #15803D;
  border-radius: var(--radius-sm);
  padding: 14px 18px; margin-top: 18px;
  font-size: .92rem;
}
.pw-check > strong:first-child { color: #15803D; }

/* Equations ------------------------------------------------ */
.pw-eq {
  background: var(--surface-2);
  border: 2px solid var(--border-soft);
  border-left: var(--bw) solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 20px; margin: 18px 0;
  overflow-x: auto;          /* long expressions scroll, the page never does */
  text-align: center;
}
.pw-eq .eqname {
  display: block; font-size: .74rem; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px;
}
/* MathJax containers must not force the page wide */
mjx-container { max-width: 100%; }
mjx-container[display="true"] { overflow-x: auto; overflow-y: hidden; padding: 2px 0; }

/* Formula list (several related equations side by side) */
.pw-eqrow {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 10px; margin: 18px 0;
}
.pw-eqrow > div {
  background: var(--surface-2); border: 2px solid var(--border-soft);
  border-radius: var(--radius-sm); padding: 12px 10px; text-align: center;
  overflow-x: auto;
}

/* Lists ---------------------------------------------------- */
.pw-article ul, .pw-article ol { margin: 0 0 16px 20px; }
.pw-article li { margin-bottom: 8px; }
.pw-list-plain { list-style: none; margin-left: 0 !important; }
.pw-list-plain > li {
  border-left: 2px solid var(--border-soft);
  padding-left: 14px; margin-bottom: 12px;
}

/* Practice questions with revealable answers */
.pw-q { margin-bottom: 12px; font-size: .94rem; }
.pw-q > summary {
  cursor: pointer; font-weight: 600; list-style: none;
  padding: 11px 14px; background: var(--surface);
  border: 2px solid var(--ink); border-radius: var(--radius-sm);
}
.pw-q > summary::-webkit-details-marker { display: none; }
.pw-q > summary::before { content: "\25B8  "; color: var(--accent); font-weight: 700; }
.pw-q[open] > summary { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.pw-q[open] > summary::before { content: "\25BE  "; }
.pw-q .ans {
  border: 2px solid var(--ink); border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 14px; background: var(--bg); font-size: .9rem;
}
.pw-q .ans p:last-child { margin-bottom: 0; }

/* Placeholder for material that is not live yet */
.pw-soon {
  border: 2px dashed var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 16px 18px; color: var(--text-muted);
  font-size: .9rem;
}

/* Other people's resources — deliberately visually separated */
.pw-external {
  border: 2px dashed var(--ink); box-shadow: none;
  background: transparent;
}
.pw-external .disclaimer { font-size: .84rem; color: var(--text-muted); margin-bottom: 14px; }
.pw-external ul { list-style: none; margin-left: 0; }
.pw-external li { padding-left: 22px; position: relative; font-size: .92rem; }
.pw-external li::before { content: "\2197"; position: absolute; left: 0; color: var(--text-muted); }

/* ── Prev / next ────────────────────────────────────────── */
.pw-pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-top: 46px; padding-top: 28px;
  border-top: var(--bw) solid var(--ink);
}
.pw-pager a {
  border: var(--bw) solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); background: var(--surface);
  padding: 16px 18px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.pw-pager a:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow); }
.pw-pager .dir {
  display: block; font-size: .7rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); margin-bottom: 4px;
}
.pw-pager .ttl { font-weight: 700; font-size: .94rem; }
.pw-pager a.next { text-align: right; }
.pw-pager .spacer { border: none; box-shadow: none; background: none; }

/* ── Hub (index) ────────────────────────────────────────── */
.pw-theme {
  border: var(--bw) solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); background: var(--surface);
  padding: 26px 28px; margin-bottom: 26px;
}
.pw-theme-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.pw-theme-letter {
  font-family: 'Archivo Black', 'Space Grotesk', sans-serif;
  font-size: 1.4rem; background: var(--gold); color: var(--ink);
  border: var(--bw) solid var(--ink); border-radius: var(--radius-sm);
  width: 44px; height: 44px; display: grid; place-items: center; flex: none;
}
.pw-theme-head h3 { font-size: 1.15rem; margin: 0; }
.pw-theme > p { font-size: .9rem; color: var(--text-muted); margin: 0 0 18px 56px; }
.pw-topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 12px; }
.pw-topic {
  display: block; background: var(--bg);
  border: 2px solid var(--ink); border-radius: var(--radius-sm);
  padding: 13px 15px;
  transition: transform .12s ease, box-shadow .12s ease, background .12s;
}
.pw-topic:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-sm); background: var(--gold-soft); }
.pw-topic .num {
  display: block; font-size: .72rem; font-weight: 700;
  letter-spacing: .05em; color: var(--gold-deep); margin-bottom: 3px;
}
.pw-topic .name { font-size: .93rem; font-weight: 600; line-height: 1.3; }
.pw-topic .hl { font-size: .64rem; font-weight: 700; color: var(--accent-dark); letter-spacing: .04em; }

.pw-intro-card {
  background: var(--ink); color: #fff;
  border: var(--bw) solid var(--ink); border-radius: var(--radius);
  box-shadow: 8px 8px 0 var(--gold);
  padding: 30px 32px; margin-bottom: 34px;
}
.pw-intro-card h2 { color: #fff; font-size: 1.35rem; margin-bottom: 12px; }
.pw-intro-card p { color: #C8CEDE; font-size: .95rem; margin-bottom: 12px; }
.pw-intro-card p:last-child { margin-bottom: 0; }
.pw-intro-card a { color: var(--gold); border-bottom: 1px solid var(--gold); }

.pw-badge-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.pw-badge {
  background: var(--surface); border: 2px solid var(--ink);
  border-radius: 999px; padding: 5px 14px; font-size: .78rem; font-weight: 600;
  /* MUST set an explicit colour: these pills sit inside .pw-intro-card, which
     sets `color: #fff` for its dark ground. Without this the white text lands
     on the white pill and the labels vanish. */
  color: var(--ink);
}

/* ── Header links (visible on mobile — .nav-links is hidden ≤640px) ── */
.pw-nav-link { font-size: .85rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.pw-nav-link:hover { color: var(--text); }

/* ── Footer link row (sits inside the shared .footer-bottom strip) ── */
.pw-foot-links { display: flex; flex-wrap: wrap; gap: 18px; }
.pw-foot-links a { font-size: .82rem; color: #AEB6CB; transition: color .15s; }
.pw-foot-links a:hover { color: #FFFFFF; }

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .pw-shell { grid-template-columns: 1fr; gap: 0; }
  .pw-rail {
    position: static; max-height: none; overflow: visible;
    margin-bottom: 30px; padding: 0;
    border: none; box-shadow: none; background: none;
  }
  .pw-rail-title { display: none; }
  .pw-rail-toggle {
    display: block; width: 100%; text-align: left;
    background: var(--surface); border: var(--bw) solid var(--ink);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    padding: 14px 18px; font-family: 'Space Grotesk', sans-serif;
    font-weight: 700; font-size: .92rem; cursor: pointer; color: var(--text);
  }
  .pw-rail-toggle::after { content: " \25BE"; color: var(--accent); }
  .pw-rail-toggle[aria-expanded="true"]::after { content: " \25B4"; }
  .pw-rail-body {
    display: none; margin-top: 12px; padding: 18px;
    background: var(--surface); border: var(--bw) solid var(--ink);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
  }
  .pw-rail-body.open { display: block; }
  .pw-article { max-width: none; }
}

@media (max-width: 640px) {
  .pw-nav-link .pnl-text { display: none; }
  .pw-nav-link { font-size: 1rem; }
  .pw-box { padding: 20px 18px; }
  .pw-article h2 { font-size: 1.15rem; margin: 34px 0 14px; }
  .pw-pager { grid-template-columns: 1fr; }
  .pw-pager a.next { text-align: left; }
  .pw-theme { padding: 20px 18px; }
  .pw-theme > p { margin-left: 0; }
  .pw-topic-grid { grid-template-columns: 1fr; }
  .pw-intro-card { padding: 22px 20px; }
  .pw-eq { padding: 12px 14px; }
}
