/* DigiTech Robotics Hub – brick theme. No web fonts, no external assets. */
:root {
  --red: #b5121b;      /* white text 6.6:1 */
  --yellow: #ffcd03;   /* navy text */
  --blue: #0057a8;     /* white text 6.9:1 */
  --green: #00752f;    /* white text 5.7:1 */
  --orange: #f68b1f;   /* navy text */
  --navy: #13294b;
  --ink: #13294b;
  --paper: #ffffff;
  --plate: #dfe6ee;
  --focus: #ff6a00;
  --radius: 10px;
  --stud: 14px;
  --font: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", "Varela Round",
          "Trebuchet MS", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { font-size: 112.5%; }               /* 18px base – large readable type */
body {
  margin: 0; font-family: var(--font); color: var(--ink); line-height: 1.5;
  background-color: var(--plate);
  /* baseplate studs */
  background-image:
    radial-gradient(circle at 50% 45%, rgba(255,255,255,.75) 0 7px, rgba(19,41,75,.10) 8px 9px, transparent 10px);
  background-size: 32px 32px;
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; width: min(1120px, 100% - 2rem); margin: 0 auto; padding: 1.5rem 0 3rem; }
main:focus { outline: none; }
h1, h2, h3 { line-height: 1.2; margin: .2em 0 .5em; font-weight: 800; letter-spacing: .01em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
a { color: var(--blue); }
img { max-width: 100%; height: auto; }
.small { font-size: .85rem; }
.muted { opacity: .8; }
.skip-link { position: absolute; left: -999px; top: .5rem; background: var(--yellow); color: var(--navy); padding: .5rem 1rem; z-index: 10; font-weight: 800; border-radius: 8px; }
.skip-link:focus { left: .5rem; }

/* Focus states – very visible */
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 4px solid var(--focus); outline-offset: 3px; border-radius: 6px;
  box-shadow: 0 0 0 9px var(--navy); /* dark halo so the ring is ≥3:1 on light and dark backgrounds */
}

/* Header */
.site-header {
  background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .75rem max(1rem, calc((100% - 1120px)/2)); flex-wrap: wrap;
  border-bottom: 6px solid var(--yellow);
}
.brand { display: flex; align-items: center; gap: .7rem; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.3rem; }
.brand-brick { position: relative; width: 44px; height: 26px; background: var(--red); border-radius: 5px; margin-top: 8px; }
.brand-brick::before { content: ""; position: absolute; top: -8px; left: 5px; right: 5px; height: 9px;
  background: radial-gradient(ellipse at 50% 60%, var(--red) 0 6px, transparent 7px) 0 0 / 17px 9px repeat-x; }
.top-nav { display: flex; gap: .5rem; }
.top-nav a { color: #fff; text-decoration: none; font-weight: 800; padding: .5rem 1rem; border-radius: 8px; border: 2px solid rgba(255,255,255,.4); }
.top-nav a:hover, .top-nav a.active { background: var(--yellow); color: var(--navy); border-color: var(--yellow); }

.breadcrumbs { width: min(1120px, 100% - 2rem); margin: .8rem auto 0; font-weight: 700; font-size: .95rem; }
.breadcrumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .3rem; }
.breadcrumbs li:not(:last-child)::after { content: "›"; margin-left: .35rem; opacity: .7; }
.breadcrumbs a { color: var(--navy); }
.breadcrumbs [aria-current] { opacity: .8; }

.site-footer { background: var(--navy); color: #fff; text-align: center; padding: 1rem; font-size: .9rem; }
.site-footer p { margin: .2rem; }

/* ---------- Bricks: cards & buttons with studs on top ---------- */
.brick {
  --brick: var(--paper); --brick-ink: var(--ink);
  position: relative; background: var(--brick); color: var(--brick-ink);
  border-radius: var(--radius); padding: 1.25rem 1.25rem 1.1rem;
  margin-top: calc(var(--stud) + 4px);
  box-shadow: inset 0 -6px 0 rgba(0,0,0,.18), 0 3px 0 rgba(19,41,75,.25);
}
.brick::before {           /* studs */
  content: ""; position: absolute; left: 14px; right: 14px; top: calc(-1 * var(--stud) + 2px); height: var(--stud);
  background:
    radial-gradient(ellipse 13px 8px at 50% 30%, rgba(255,255,255,.35) 0 60%, transparent 62%) 0 0 / 40px var(--stud) repeat-x,
    linear-gradient(var(--brick), var(--brick)) 0 0 / 0 0 no-repeat;
  -webkit-mask: radial-gradient(ellipse 13px 100% at 50% 100%, #000 98%, transparent 100%) 0 0 / 40px var(--stud) repeat-x;
          mask: radial-gradient(ellipse 13px 100% at 50% 100%, #000 98%, transparent 100%) 0 0 / 40px var(--stud) repeat-x;
  background-color: var(--brick);
  filter: brightness(.95);
}
.brick.red    { --brick: var(--red);    --brick-ink: #fff; }
.brick.blue   { --brick: var(--blue);   --brick-ink: #fff; }
.brick.green  { --brick: var(--green);  --brick-ink: #fff; }
.brick.yellow { --brick: var(--yellow); --brick-ink: var(--navy); }
.brick.orange { --brick: var(--orange); --brick-ink: var(--navy); }
.brick.navy   { --brick: var(--navy);   --brick-ink: #fff; }
.brick a { color: inherit; }

/* Big clickable brick tiles */
a.brick, button.brick { display: block; text-decoration: none; font: inherit; border: 0; cursor: pointer; text-align: left; width: 100%;
  transition: transform .08s ease, box-shadow .08s ease; }
a.brick:hover, button.brick:hover { transform: translateY(-3px); box-shadow: inset 0 -6px 0 rgba(0,0,0,.18), 0 7px 0 rgba(19,41,75,.25); }
a.brick:active, button.brick:active { transform: translateY(2px); box-shadow: inset 0 -3px 0 rgba(0,0,0,.18), 0 1px 0 rgba(19,41,75,.25); }

.btn {                     /* big child-friendly buttons */
  --brick: var(--blue); --brick-ink: #fff;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 56px; min-width: 56px; padding: .7rem 1.5rem; margin-top: 12px;
  font: inherit; font-size: 1.15rem; font-weight: 800; text-decoration: none; cursor: pointer;
  background: var(--brick); color: var(--brick-ink); border: 0; border-radius: 10px;
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.2), 0 3px 0 rgba(19,41,75,.25);
}
.btn::before { content: ""; position: absolute; left: 10px; right: 10px; top: -9px; height: 10px; background-color: var(--brick); filter: brightness(.95);
  -webkit-mask: radial-gradient(ellipse 9px 100% at 50% 100%, #000 98%, transparent 100%) 0 0 / 28px 10px repeat-x;
          mask: radial-gradient(ellipse 9px 100% at 50% 100%, #000 98%, transparent 100%) 0 0 / 28px 10px repeat-x; }
.btn:hover { filter: brightness(1.08); }
.btn.red { --brick: var(--red); } .btn.green { --brick: var(--green); }
.btn.yellow { --brick: var(--yellow); --brick-ink: var(--navy); }
.btn.orange { --brick: var(--orange); --brick-ink: var(--navy); }
.btn.navy { --brick: var(--navy); }
.btn.ghost { --brick: #fff; --brick-ink: var(--navy); }
.btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }

/* Layout helpers */
.grid { display: grid; gap: 1.25rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.weeks { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem 1rem; }
.row { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; }
.row.spread { justify-content: space-between; }
.intro { background: rgba(255,255,255,.92); border-radius: var(--radius); padding: 1rem 1.25rem; box-shadow: 0 3px 0 rgba(19,41,75,.15); }

/* Home doors */
.doors { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-top: 1rem; }
.door { min-height: 260px; display: flex !important; flex-direction: column; justify-content: center; align-items: center; text-align: center !important; }
.door .door-icon { font-size: 4rem; line-height: 1; }
.door .door-title { font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 800; }
.door .door-sub { font-size: 1.1rem; opacity: .95; }

.tile-title { font-size: 1.5rem; font-weight: 800; display: block; }
.tile-sub { display: block; font-size: 1rem; opacity: .95; }
.week-tile { min-height: 130px; padding: 1rem; }
.week-tile .wk-num { font-size: 1.6rem; font-weight: 800; display: block; }
.week-tile .wk-stage { font-size: .95rem; font-weight: 700; display: block; }
.week-tile .wk-sensor { display: inline-block; margin-top: .4rem; font-size: .75rem; font-weight: 800; background: rgba(255,255,255,.9); color: var(--navy); padding: .1rem .5rem; border-radius: 999px; }
.tag { display: inline-block; background: var(--yellow); color: var(--navy); font-weight: 800; padding: .15rem .6rem; border-radius: 999px; font-size: .85rem; }

/* Module page */
.module-head .goal { font-size: 1.2rem; }
.steps { list-style: none; padding: 0; margin: 0; counter-reset: step; display: grid; gap: 1.25rem; }
.step { counter-increment: step; display: grid; grid-template-columns: 1fr minmax(240px, 1fr); gap: 1rem; align-items: start; }
.step .step-text { font-size: 1.15rem; }
.step .step-text::before { content: "Step " counter(step); display: block; font-weight: 800; color: var(--red); font-size: 1.2rem; }
.step.labelled { counter-increment: none; }
.step.labelled .step-text::before { content: attr(data-label); }
@media (max-width: 720px) { .step { grid-template-columns: 1fr; } }
.img-slot { border: 4px dashed var(--navy); border-radius: var(--radius); min-height: 180px; display: flex; align-items: center; justify-content: center;
  text-align: center; font-weight: 800; padding: 1rem; background: repeating-linear-gradient(45deg, #f4f7fb 0 14px, #e8eef6 14px 28px); color: var(--navy); }
.img-slot.code { border-color: var(--blue); }
.img-slot .ico { font-size: 2rem; display: block; }
.step figure { margin: 0; }
.step figure img { border-radius: var(--radius); border: 3px solid var(--navy); background: #fff; }
.evidence-box { border: 4px solid var(--navy); }
.evidence-lines { margin-top: .75rem; height: 90px; background: repeating-linear-gradient(#fff 0 28px, #9aa8bb 28px 30px); border-radius: 6px; }
.pager { margin-top: 2rem; }

/* Teacher slots */
.slot { min-height: 120px; }
.slot.empty { --brick: #f2f4f7; outline: 3px dashed #7d8aa0; outline-offset: -8px; }
.slot .slot-label { font-weight: 800; font-size: 1.05rem; display: block; margin-bottom: .3rem; }
.slot .not-added { display: inline-block; font-weight: 800; background: #fff; border: 2px solid var(--navy); padding: .1rem .6rem; border-radius: 999px; font-size: .85rem; }
.slot iframe { width: 100%; aspect-ratio: 16/9; border: 3px solid var(--navy); border-radius: 8px; background: #fff; }
.slot iframe.pdf { aspect-ratio: 1/1.3; }
.code-list { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; list-style: none; }
.code-list li { background: var(--navy); color: #fff; padding: .15rem .6rem; border-radius: 6px; font-weight: 700; font-size: .9rem; }
.week-list { list-style: none; padding: 0; display: grid; gap: .3rem 1rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.week-list a { display: block; padding: .6rem .9rem; background: #fff; border-radius: 8px; font-weight: 700; text-decoration: none; color: var(--navy); border-left: 8px solid var(--blue); min-height: 48px; }
.week-list a:hover { background: var(--yellow); }

/* Gate */
.gate { max-width: 560px; margin: 0 auto; }
.gate label { display: block; font-weight: 800; margin: .5rem 0 .3rem; }
.gate input { width: 100%; font: inherit; font-size: 1.2rem; padding: .7rem .9rem; border: 3px solid var(--navy); border-radius: 8px; }
.warning { background: #fff3cd; color: #5c3b00; border: 3px solid #b77b00; border-radius: 8px; padding: .75rem 1rem; font-weight: 800; }

.error-box { background: #fff; border: 4px solid var(--red); border-radius: var(--radius); padding: 1rem 1.25rem; }
.print-only { display: none; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.sr-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.booklet { background: #fff; border-radius: var(--radius); padding: 1rem 1.5rem; margin-top: 1rem; box-shadow: 0 3px 0 rgba(19,41,75,.2); }
.booklet .print-module + .print-module { border-top: 4px dashed #9aa8bb; margin-top: 2rem; padding-top: 1rem; }
.booklet .brick { --brick: #fff !important; --brick-ink: #000 !important; box-shadow: none; border: 2px solid #000; }
.booklet .brick::before { display: none; }
.booklet .step .step-text::before { color: #000; }
.small-btn { font-size: 1rem; min-height: 48px; padding: .5rem 1rem; }
main#main:focus, main#main:focus-visible { outline: none; box-shadow: none; }
.brick::before, .btn::before { -webkit-mask-position: center top; mask-position: center top; }

/* Teacher text cards: long words/URLs never run past the card edge */
.slot p { overflow-wrap: anywhere; word-break: break-word; }
.slot a.src-link { font-weight: 800; text-decoration: underline; color: inherit; }
