/* Institutional typography, light subpages, emblem, sticky Academy menu.
   Inspired by the calm of long-standing academic sites, never copied:
   no outside names, crests, or colors used as a seal. */

@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/SourceSerif4Variable-Roman.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --display: "Source Serif 4", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --serif: var(--display);
}

h1, h2, h3,
.jp-idea h2,
.jp h3,
.film-frame strong,
.cover-title,
.sub-hero h1,
.portal h3,
.join-strip h2 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.02em;
}

/* Slightly quieter landing motion */
.hero-art .orb { will-change: transform; }

/* Emblem + refined brand */
.brand-emblem {
  width: 40px;
  height: 40px;
  display: block;
  flex-shrink: 0;
}
.brand-word {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.01em;
  font-size: 0.98rem;
  line-height: 1.15;
}
.hero-emblem {
  width: 112px;
  height: 112px;
  display: block;
  margin: 0 0 22px;
}
.lede-short {
  max-width: 22em;
  font-size: 1.12rem;
  color: var(--muted);
}

/* How to join */
.join-strip {
  position: relative;
  z-index: 2;
  padding: 96px 0 80px;
  border-top: 1px solid var(--hair);
}
.join-strip h2 {
  font-size: clamp(2rem, 4.4vw, 3.4rem);
  margin: 0 0 36px;
  line-height: 1.08;
  color: var(--fg-strong);
}
.join-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
}
.join-steps li { border-right: 1px solid var(--hair); }
.join-steps li:last-child { border-right: 0; }
.join-steps a {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 28px 22px 32px;
  color: inherit;
  text-decoration: none;
  min-height: 180px;
}
.join-steps a:hover { background: rgba(47, 180, 255, 0.06); color: inherit; }
.join-num {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: var(--accent);
}
.join-steps strong {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.45rem;
  color: var(--fg-strong);
}
.join-steps span:last-child { color: var(--muted); font-size: 0.95rem; }
.join-more { margin: 22px 0 0; }
.join-steps-on-page { margin-top: 12px; }

/* Library band on the landing */
.library-band {
  position: relative;
  z-index: 2;
  padding: 88px 0 48px;
  border-top: 1px solid var(--hair);
}
.library-link { text-align: center; margin: 8px 0 0; }

/* Graphical portals */
.portals {
  position: relative;
  z-index: 2;
  padding: 48px 0 120px;
}
.portal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--hair);
  border-left: 1px solid var(--hair);
}
.portal {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 32px 28px 36px;
  min-height: 220px;
  color: inherit;
  text-decoration: none;
  border-right: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  background: transparent;
}
.portal:hover { background: rgba(47, 180, 255, 0.06); color: inherit; }
.portal-kicker {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.portal h3 {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1.1;
  color: var(--fg-strong);
}
.portal p { margin: 0; color: var(--muted); }
.portal-keycap {
  align-self: flex-start;
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.08em;
  border: 1.5px solid var(--accent);
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  background: var(--accent);
  color: var(--ink);
  box-shadow: 0 2px 0 rgba(47, 180, 255, 0.35), inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}
.portal-dim { background: rgba(255, 255, 255, 0.015); }

/* Sticky Academy submenu + Back to Home (subpages) */
.academy-rail {
  position: sticky;
  top: calc(var(--draft-h) + var(--nav-h));
  z-index: 40;
  background: rgba(244, 241, 234, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hair);
}
.academy-rail-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 48px;
}
.academy-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1.15rem;
}
.academy-menu a,
.academy-anchors a,
.academy-drawer a {
  color: var(--fg);
  text-decoration: none;
  font-size: 0.88rem;
  letter-spacing: 0.01em;
}
.academy-menu a:hover,
.academy-anchors a:hover,
.academy-drawer a:hover { color: var(--accent); }
.academy-menu a[aria-current="page"],
.academy-drawer a[aria-current="page"] {
  color: var(--fg-strong);
  box-shadow: inset 0 -2px 0 var(--accent);
  font-weight: 600;
}
.academy-anchors {
  display: flex;
  align-items: baseline;
  gap: 14px 18px;
  padding: 0 0 10px;
  flex-wrap: wrap;
}
.academy-anchors ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.9rem;
}
.academy-anchors-label {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.academy-menu-toggle {
  display: none;
  margin-left: auto;
  min-height: 40px;
  padding: 0 0.8rem;
  border: 1px solid var(--hair-strong);
  border-radius: var(--radius-btn);
  background: transparent;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  color: inherit;
}
.academy-drawer {
  display: none;
  border-top: 1px solid var(--hair);
  padding: 12px 0 18px;
}
.academy-drawer[hidden] { display: none !important; }
.academy-drawer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.academy-drawer .back-home { display: inline-flex; margin-bottom: 12px; }

.back-home {
  color: var(--fg-strong);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.back-home-bar {
  font-weight: 600;
  padding-right: 16px;
  border-right: 1px solid var(--hair);
}
.back-home-bar::before { content: "← "; }
.back-home-row { margin: 0; }
.back-home-row.back-home-top { padding: 28px 0 0; }
.back-home-row.back-home-bottom { padding: 8px 0 56px; }
.back-home-row .back-home.btn { display: inline-flex; }

.sub-hero {
  padding: 48px 0 24px;
}
.sub-hero h1 {
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  line-height: 1.04;
  margin: 0 0 16px;
  color: var(--fg-strong);
}
.sub-hero .lede {
  max-width: 38rem;
  font-size: 1.15rem;
  color: var(--muted);
  margin: 0;
}

/* Ivory content pages */
body.page-sub {
  --bg: #f4f1ea;
  --ink: #161513;
  --fg: #1c1b18;
  --fg-strong: #111110;
  --muted: rgba(22, 21, 19, 0.68);
  --faint: rgba(22, 21, 19, 0.46);
  --hair: rgba(22, 21, 19, 0.12);
  --hair-strong: rgba(22, 21, 19, 0.2);
  --accent: #0a6fa3;
  --accent-soft: rgba(10, 111, 163, 0.1);
  --accent-line: rgba(10, 111, 163, 0.38);
  --link: #0a6fa3;
  background: var(--bg);
  color: var(--fg);
}
body.page-sub a { color: var(--link); }
body.page-sub a:hover { color: #085781; }
body.page-sub .btn-primary,
body.page-sub .nav-cta,
body.page-sub .assignment.live .as-tag,
body.page-sub .portal-keycap {
  background: #161513;
  color: #f4f1ea;
  border-color: #161513;
  box-shadow: none;
}
body.page-sub .btn-primary:hover,
body.page-sub .nav-cta:hover { color: #fff; }
body.page-sub .btn-glass {
  background: transparent;
  color: var(--fg-strong);
  border-color: var(--hair-strong);
}
body.page-sub .site-header,
body.page-sub .nav-bar {
  background: rgba(244, 241, 234, 0.92);
}
body.page-sub .draft-banner {
  background: #161513;
  color: #f4f1ea;
}
body.page-sub .nav-socials a,
body.page-sub .nav-links a { color: var(--fg); }
body.page-home .page-watermark img {
  opacity: 0.07;
  filter: none;
  mix-blend-mode: normal;
}
body.page-sub .page-watermark img {
  opacity: 0.035;
  mix-blend-mode: multiply;
  filter: grayscale(1) contrast(0.85) brightness(1.15);
}
@media (max-width: 960px) {
  body.page-sub .page-watermark img { opacity: 0.032; }
}
@media (max-width: 760px) {
  body.page-sub .page-watermark img { opacity: 0.03; }
}
body.page-sub .guides { opacity: 0.45; }
body.page-sub .page-traces { opacity: 0.35; }
body.page-sub .circuit-field { opacity: 0.12; }
body.page-sub .site-footer {
  background: transparent;
  border-top: 1px solid var(--hair);
  color: var(--fg);
}
body.page-sub .as-tag {
  background: #f4f1ea;
  color: var(--fg-strong);
  box-shadow: 0 2px 0 rgba(22, 21, 19, 0.12), inset 0 -2px 0 rgba(0, 0, 0, 0.06);
}
body.page-sub .certificate {
  /* Keep the existing dark certificate preview (open decision). */
  box-shadow: 0 18px 48px rgba(22, 21, 19, 0.12);
}
body.page-sub .cover-face {
  background:
    radial-gradient(circle at 50% 24%, rgba(10, 111, 163, 0.12), transparent 58%),
    #161513;
  color: #e6edf3;
}
body.page-sub .cover-title { color: #fff; }
body.page-sub .hash { color: var(--link); }

.roadmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}
.roadmap-grid .cover-card {
  position: relative;
  inset: auto;
  transform: none !important;
  backface-visibility: visible;
}
.roadmap-grid .cover-face { min-height: 220px; }

.about-lede {
  font-family: var(--serif);
  font-size: 1.35rem;
  line-height: 1.45;
  max-width: 40rem;
  padding-bottom: 8px;
}
.about-lede p { margin: 0 0 1rem; }

html { scroll-padding-top: calc(var(--draft-h) + var(--nav-h) + 64px); }
body.page-sub { scroll-padding-top: calc(var(--draft-h) + var(--nav-h) + 108px); }

@media (max-width: 960px) {
  .portal-grid,
  .join-steps { grid-template-columns: 1fr 1fr; }
  .join-steps li:nth-child(2) { border-right: 0; }
}
@media (max-width: 760px) {
  .academy-menu { display: none; }
  .academy-anchors { display: none; }
  .academy-menu-toggle { display: inline-flex; align-items: center; }
  .academy-rail.is-open .academy-drawer { display: block; }
  .academy-rail.is-open .academy-drawer[hidden] { display: block !important; }
  .portal-grid,
  .join-steps { grid-template-columns: 1fr; }
  .join-steps li { border-right: 0; border-bottom: 1px solid var(--hair); }
  .hero-emblem { width: 88px; height: 88px; }
  .back-home-bar { border-right: 0; padding-right: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .academy-rail { backdrop-filter: none; }
}

.brand img.brand-emblem { height: 40px; width: 40px; }
body.page-home .brand-word { color: var(--fg-strong); }

@keyframes hero-orb-scroll {
  from { --hero-s: 1; --hero-r: 0deg; }
  to { --hero-s: 1.08; --hero-r: 8deg; }
}
@keyframes hero-spread {
  from { --spread: 1; }
  to { --spread: 1.22; }
}

/* Keep the nav CTA readable on ivory pages (do not inherit body text color). */
body.page-sub .nav-links a.nav-cta,
body.page-sub a.nav-cta {
  background: #161513;
  color: #f4f1ea !important;
}
body.page-sub .nav-links a.nav-cta .chev { color: #f4f1ea; }

.hero-emblem {
  width: 176px;
  height: 176px;
  margin: 0 0 28px;
}
.brand img.brand-emblem { height: 48px; width: 48px; }
@media (max-width: 760px) {
  .hero-emblem { width: 120px; height: 120px; }
}
