/* ==========================================================
   Cyber Town — unit study page
   New layout, same tokens as style.css (loaded first).
   One long scroll, foldable ## sections, contents + glossary rail.
   ========================================================== */

/* Content pages use the calm pink-and-grey notebook, not the road plate.
   The Cyber Town road artwork stays on Home and About. */
.unit-page {
  background-color: var(--mist);
  background-image:
    radial-gradient(1100px 460px at 12% -6%, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0) 60%),
    radial-gradient(900px 520px at 100% 0%, rgba(239, 137, 180, 0.14), rgba(255, 255, 255, 0) 55%);
  background-attachment: fixed;
}

/* ---------- Banner ---------- */

.unit-banner {
  width: 100%;
  line-height: 0;
}

.unit-banner img {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------- Masthead ---------- */

.unit-masthead {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 32px 8px;
}

.page-title--unit {
  position: static;
  width: auto;
  max-width: none;
  text-align: left;
  line-height: 0.92;
  font-size: clamp(40px, 4.6vw, 74px);
  color: var(--ink);
}

.unit-meta {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: center;
}

.pill {
  font-family: "Lato", sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  background-color: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 4px 12px;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.pill--accent {
  color: #fff;
  background-color: var(--flamingo);
  border-color: var(--flamingo-deep);
}

/* ---------- Shell: rail + main ---------- */

.unit-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 32px 96px;
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

/* ---------- Left rail ---------- */

.unit-rail {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding-right: 4px;
}

.unit-card,
.unit-controls {
  background-color: rgba(255, 255, 255, var(--card-alpha));
  -webkit-backdrop-filter: blur(var(--card-blur));
  backdrop-filter: blur(var(--card-blur));
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: 4px;
  padding: 16px 18px;
  margin-bottom: 16px;
}

.unit-rail-heading {
  font-family: "Lato", sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--flamingo-deep);
  margin-bottom: 12px;
}

.unit-controls input[type="search"] {
  width: 100%;
  font: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
}

.unit-controls input[type="search"]:focus {
  outline: 2px solid var(--flamingo);
  border-color: var(--flamingo);
}

.unit-controls-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.unit-btn {
  flex: 1;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 8px 6px;
  cursor: pointer;
}

.unit-btn:hover {
  color: var(--ink);
  border-color: var(--flamingo);
  background: rgba(239, 137, 180, 0.16);
}

.unit-count {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 8px;
  min-height: 1em;
}

.unit-toc {
  list-style: none;
  margin: 0;
  padding: 0;
}

.unit-toc li { margin: 2px 0; }

.unit-toc a {
  display: block;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.35;
  padding: 5px 8px;
  border-radius: 6px;
}

.unit-toc a:hover { background: rgba(239, 137, 180, 0.16); color: var(--ink); }
.unit-toc a.is-active { background: var(--flamingo); color: #fff; }
.unit-toc a.is-dim { opacity: 0.32; }

.unit-gloss { margin: 0; }
.unit-term { margin-bottom: 10px; }
.unit-gloss dt { font-weight: 700; font-size: 14.5px; color: var(--ink); }
.unit-gloss dd { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-soft); }
.unit-gloss-note { margin-top: 8px; font-size: 12px; color: var(--ink-soft); opacity: 0.8; }

/* ---------- Main: foldable sections ---------- */

.unit-section {
  background-color: rgba(255, 255, 255, var(--card-alpha));
  -webkit-backdrop-filter: blur(var(--card-blur));
  backdrop-filter: blur(var(--card-blur));
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: 4px;
  margin-bottom: 16px;
  overflow: hidden;
  scroll-margin-top: 16px;
}

.unit-section > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  font-family: "Lato", sans-serif;
  font-weight: 700;
  font-size: 21px;
  color: var(--flamingo);
  text-shadow: 0 0 18px var(--flamingo-glow);
}

.unit-section > summary::-webkit-details-marker { display: none; }

.unit-section > summary::before {
  content: "";
  width: 9px;
  height: 9px;
  flex: none;
  border-right: 2px solid var(--flamingo-deep);
  border-bottom: 2px solid var(--flamingo-deep);
  transform: rotate(-45deg);
  transition: transform 0.18s ease;
}

.unit-section[open] > summary::before { transform: rotate(45deg); }
.unit-section > summary:hover { color: var(--flamingo-deep); }

.unit-section-body {
  padding: 4px 24px 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.6);
  color: var(--ink);
}

.unit-section-body > *:first-child { margin-top: 16px; }

.unit-section--descriptor {
  border-style: dashed;
  border-color: var(--flamingo);
  background-color: rgba(239, 137, 180, 0.12);
}

.unit-section--descriptor > summary {
  font-size: 17px;
  color: var(--flamingo-deep);
  text-shadow: none;
}

.unit-scope-tag {
  margin-left: auto;
  font-family: "Lato", sans-serif;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  background: var(--flamingo);
  border-radius: 999px;
  padding: 3px 10px;
}

.unit-section.is-hidden { display: none; }

/* ---------- Content typography inside a section ---------- */

.unit-section-body h3 {
  font-family: "Lato", sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  margin: 22px 0 6px;
}

.unit-section-body h4 {
  font-family: "Lato", sans-serif;
  font-weight: 700;
  font-size: 15.5px;
  color: var(--ink-soft);
  margin: 16px 0 4px;
}

.unit-section-body p { max-width: 72ch; margin-bottom: 16px; }
.unit-section-body ul,
.unit-section-body ol { max-width: 72ch; margin: 0 0 16px 1.2em; }
.unit-section-body li { margin-bottom: 6px; }

.unit-section-body a { color: var(--flamingo-deep); }
.unit-section-body a:hover { color: var(--flamingo); }

.unit-section-body img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--card-border);
}

.unit-section-body blockquote {
  margin: 16px 0;
  padding: 6px 18px;
  border-left: 3px solid var(--flamingo);
  background: rgba(239, 137, 180, 0.1);
  color: var(--ink-soft);
}

.unit-section-body code {
  background: rgba(255, 255, 255, 0.6);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}

.unit-section-body pre.mermaid {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  overflow: auto;
}

.unit-section-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 16px 0;
  font-size: 15px;
}

.unit-section-body th,
.unit-section-body td {
  border: 1px solid var(--card-border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.unit-section-body th { background: rgba(239, 137, 180, 0.16); }

.unit-section-body mark { background: #ffe08a; padding: 0 2px; border-radius: 3px; }

/* ---------- Responsive ---------- */

@media (max-width: 1000px) {
  .unit-page { background-attachment: scroll; background-position: center; }
  .unit-masthead { padding-top: 72px; }
  .unit-shell { grid-template-columns: 1fr; }
  .unit-rail {
    position: static;
    max-height: none;
    order: 2;
  }
}

/* ---------- Units index ---------- */
.unit-shell--index { grid-template-columns: 1fr; }
.unit-index-card { padding: 8px 6px; }
.unit-index-table { border-collapse: collapse; width: 100%; font-size: 15.5px; }
.unit-index-table th,
.unit-index-table td {
  text-align: left; padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.6);
}
.unit-index-table th {
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--flamingo-deep);
}
.unit-index-table .u-code a { font-weight: 700; color: var(--flamingo-deep); }
.unit-index-table a { color: var(--ink); text-decoration: none; }
.unit-index-table a:hover { color: var(--flamingo); }

/* ==========================================================
   Study shell: shared top nav band + landing / plain pages
   Added Aug 2026. Banner strip, dark grey nav, light pink links.
   ========================================================== */

.study-nav {
  background: var(--ink-soft);
  border-bottom: 2px solid var(--flamingo-deep);
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 26px;
  padding: 13px 32px;
}

.study-nav a {
  color: #f3cfe0;
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.study-nav a:hover { color: #fff; }

.study-nav a.is-current {
  color: #fff;
  border-bottom: 2px solid var(--flamingo-glow);
  padding-bottom: 2px;
}

.study-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 6px 32px 96px;
}

.study-wrap--narrow { max-width: 820px; }

.study-card {
  background-color: rgba(255, 255, 255, var(--card-alpha));
  -webkit-backdrop-filter: blur(var(--card-blur));
  backdrop-filter: blur(var(--card-blur));
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: 4px;
  padding: 22px 26px;
  margin-bottom: 16px;
}

.study-lead { max-width: 70ch; margin-bottom: 18px; color: var(--ink); }

.study-search {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 11px 14px;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  margin-bottom: 16px;
}

.study-search:focus { outline: 2px solid var(--flamingo); border-color: var(--flamingo); }

.study-empty { color: var(--ink-soft); font-size: 15px; padding: 8px 2px; }

/* Plain prose for About and any future simple page */
.study-prose h2 {
  font-family: "Lato", sans-serif; font-weight: 700; font-size: 22px;
  color: var(--flamingo); text-shadow: 0 0 18px var(--flamingo-glow);
  margin: 6px 0 12px;
}
.study-prose h3 { font-weight: 700; font-size: 18px; color: var(--ink); margin: 20px 0 6px; }
.study-prose p { max-width: 70ch; margin-bottom: 16px; color: var(--ink); }
.study-prose a { color: var(--flamingo-deep); }
.study-prose a:hover { color: var(--flamingo); }
.study-prose ul, .study-prose ol { max-width: 70ch; margin: 0 0 16px 1.2em; }
.study-prose li { margin-bottom: 6px; }

@media (max-width: 1000px) {
  .study-nav { padding: 12px 20px; }
  .study-wrap { padding: 6px 20px 60px; }
}

/* ==========================================================
   Homepage: dark hero (flush) + dark grey unit list
   Added Aug 2026.
   ========================================================== */

body.home-index { background: #090b0e; }

.home-hero { width: 100%; line-height: 0; }
.home-hero img { display: block; width: 100%; height: auto; }

.home-units {
  background: #090b0e;
  padding: 8px 0 72px;
}

.home-units-inner { max-width: 900px; margin: 0 auto; padding: 0 28px; }

.home-search {
  width: 100%;
  font: inherit; font-size: 15px;
  padding: 11px 14px;
  margin: 22px 0 10px;
  color: #f3e9ee;
  background: #2c2b30;
  border: 1px solid #45424a;
  border-radius: 6px;
}
.home-search::placeholder { color: #9d97a1; }
.home-search:focus { outline: 2px solid var(--flamingo); border-color: var(--flamingo); }

.home-unit-list { list-style: none; margin: 0; padding: 0; }

/* Faint pink rule separating the Certificate IV set from the other ICT units */
.home-unit-divider {
  border: 0;
  border-top: 1px solid rgba(211, 107, 147, 0.32);
  margin: 40px 0 4px;
}

.home-unit {
  border-bottom: 1px solid #34323a;
}
.home-unit a,
.home-unit .hu-inner {
  display: flex; align-items: baseline; gap: 16px;
  padding: 13px 6px;
  text-decoration: none;
}
.home-unit a:hover { background: #2c2b31; }
.home-unit a:hover .hu-name { color: #fff; }

.hu-code {
  flex: none;
  min-width: 108px;
  font-family: "Lato", sans-serif;
  font-weight: 700; font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--flamingo-glow);
}
.hu-name { color: #d9d4dd; font-size: 16px; }

.home-unit--soon .hu-inner { cursor: default; }
.home-unit--soon .hu-code { color: #b56a89; }
.home-unit--soon .hu-name { color: #8f8a95; }
.hu-soon {
  margin-left: auto; flex: none;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: #8f8a95; border: 1px solid #45424a; border-radius: 999px; padding: 2px 9px;
}
.home-units .study-empty { color: #9d97a1; }

@media (max-width: 640px) {
  .hu-code { min-width: 88px; font-size: 13px; }
  .hu-name { font-size: 15px; }
}

/* ==========================================================
   About: highway banner + spiral notebook with clickable tabs
   ========================================================== */

.about-wrap { max-width: 1180px; margin: 0 auto; padding: 18px 24px 80px; }

.notebook {
  position: relative;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
}
.notebook > img { display: block; width: 100%; height: auto; }

/* Clickable tabs sit over the drawn pink tabs on the right edge */
.nb-tab {
  position: absolute;
  right: 1.4%;
  width: 11.5%;
  height: 6.4%;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; cursor: pointer;
  font-family: "Lato", sans-serif; font-weight: 700;
  font-size: clamp(8px, 0.92vw, 12px);
  letter-spacing: 0.01em;
  color: #6a2b45;
  border-radius: 4px;
  transition: transform 0.12s ease;
}
.nb-tab:hover { color: #3f172a; transform: translateX(-3px); }
.nb-tab.is-active { color: #fff; background: rgba(176,74,112,0.62); }

/* Reading pane over the paper area (left of the tabs) */
.nb-pane {
  position: absolute;
  left: 7%; top: 12%; width: 74%; bottom: 12%;
  overflow: auto;
  display: flex; flex-direction: column; justify-content: center;
}
.nb-pane-code {
  font-family: "Lato", sans-serif; font-weight: 700;
  font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--flamingo-deep);
}
.nb-pane-name {
  font-family: "Just Me Again Down Here", cursive;
  font-size: clamp(26px, 3.6vw, 46px);
  line-height: 1.0; color: var(--ink); margin: 2px 0 10px;
}
.nb-pane-blurb { font-size: clamp(13px, 1.5vw, 16px); color: var(--ink-soft); max-width: 46ch; margin-bottom: 8px; }
.nb-pane-prereq { font-size: 12.5px; color: var(--flamingo-deep); margin-bottom: 14px; }
.nb-open {
  align-self: flex-start;
  font-family: "Lato", sans-serif; font-weight: 700; font-size: 13.5px;
  letter-spacing: 0.04em; text-decoration: none;
  color: #fff; background: var(--flamingo); border: 1px solid var(--flamingo-deep);
  border-radius: 999px; padding: 8px 18px;
}
.nb-open:hover { background: var(--flamingo-deep); }
.nb-soon { align-self: flex-start; font-size: 13px; color: var(--ink-soft); font-style: italic; }

/* Small screens: drop the image-tab interaction, show a plain card list */
.about-list { display: none; }
@media (max-width: 760px) {
  .notebook { display: none; }
  .about-list { display: block; }
  .about-card {
    background-color: rgba(255,255,255,var(--card-alpha));
    border: 1px solid var(--card-border); border-radius: 6px;
    padding: 16px 18px; margin-bottom: 12px;
  }
  .about-card .nb-pane-name { font-size: 30px; }
}

/* ==========================================================
   Unit Notebook page: single combined image CSink_about.png
   (highway + notebook + baked pink nav). Overlay hotspots.
   ========================================================== */

.nbk { position: relative; width: 100%; max-width: 1000px; margin: 0 auto; }
.nbk > img { display: block; width: 100%; height: auto; }

/* clickable areas over the baked HOME / ABOUT / UNIT NOTEBOOK words */
.nb-nav a {
  position: absolute; top: 0.4%; height: 7.4%;
  display: block; border-radius: 4px;
}
.nb-nav a:hover { background: rgba(239, 137, 180, 0.20); }
.nb-nav a:focus-visible { outline: 2px solid var(--flamingo); }

/* tab hotspots over the blank pink tabs; code label supplied here */
.nbk .nb-tab {
  height: 4.6%; right: 1%; width: 10%;
  font-size: clamp(7px, 0.95vw, 11px);
}

/* reading pane over the notebook paper (below the highway band) */
.nbk .nb-pane { top: 41%; left: 12.5%; width: 65%; bottom: 4%; }

/* mobile: hide the image, show a plain nav + card list */
.nb-mininav { display: none; }
@media (max-width: 760px) {
  .nbk { display: none; }
  .nb-mininav {
    display: flex; gap: 20px; justify-content: flex-end;
    background: var(--ink-soft); padding: 12px 18px;
  }
  .nb-mininav a {
    color: #f3cfe0; text-decoration: none;
    font-size: 12.5px; letter-spacing: 0.12em; text-transform: uppercase;
  }
  .nb-mininav a:hover { color: #fff; }
}

/* ==========================================================
   Homepage restyle (mockup Aug 2026):
   near-black, serif in muted rose, two columns, nav on the hero,
   no centre nav band, no search.
   ========================================================== */

body.home-index { background: #090b0e; }

.home-hero { position: relative; }
.hero-nav {
  position: absolute; top: 16px; right: 34px; z-index: 5;
  display: flex; gap: 30px;
}
.hero-nav a {
  font-family: "Lato", sans-serif;
  color: var(--flamingo-glow); text-decoration: none;
  font-size: 14px; letter-spacing: 0.16em; text-transform: uppercase;
}
.hero-nav a:hover { color: #fff; }

.home-units { background: #090b0e; padding: 30px 0 96px; }
.home-units-inner { max-width: 780px; margin: 0 auto; padding: 0 40px; }
.home-unit-list { list-style: none; margin: 0; padding: 0; }

.home-unit { border-bottom: none; }
.home-unit a,
.home-unit .hu-inner {
  display: flex; align-items: baseline; gap: 24px;
  padding: 7px 2px; text-decoration: none;
  font-family: "EB Garamond", Georgia, serif;
  text-transform: uppercase; letter-spacing: 0.07em;
}
.home-unit a:hover { background: transparent; }
.home-unit .hu-code {
  flex: none; min-width: 132px;
  font-size: 18px; font-weight: 600; letter-spacing: 0.05em;
  color: #e584ad;
}
.home-unit .hu-name { font-size: 18px; font-weight: 500; color: #e584ad; }
.home-unit a:hover .hu-code,
.home-unit a:hover .hu-name { color: var(--flamingo-glow); }
.home-unit--soon { opacity: 0.5; }
.home-unit--soon .hu-code,
.home-unit--soon .hu-name { color: #e584ad; }
.hu-soon { display: none; }

@media (max-width: 640px) {
  .home-units-inner { padding: 0 22px; }
  .home-unit .hu-code { min-width: 104px; font-size: 16px; }
  .home-unit .hu-name { font-size: 16px; }
  .hero-nav { top: 10px; right: 16px; gap: 16px; }
  .hero-nav a { font-size: 12px; letter-spacing: 0.1em; }
}

/* Unit Notebook page: full-bleed, no white margins (fills the width) */
body.notebook-page { background: #2b2a2e; }
.notebook-page .about-wrap { max-width: none; margin: 0; padding: 0; }
.notebook-page .nbk { max-width: none; margin: 0; }
@media (max-width: 760px) {
  .notebook-page .about-list { padding: 16px; }
}
