/* Learning Corner — the front door to one child's pages, drawn as the
   opening page of a superhero comic (2026-11-18, at Lewis's request).

   What makes the look, so a later change keeps it:
   - INK: one near-black for every outline, and a hard shadow of the same ink
     pushed down-right with no blur. Nothing here has a soft shadow.
   - Three hero colours, one per door (red, blue, green), plus the yellow
     that belongs to the page itself: title, caption box, GO! bursts.
   - Halftone dots and burst rays behind each picture; slanted heavy
     capitals for names; a slight tilt on each panel.

   Design language only. No publisher's or team's name, logo, emblem,
   character, costume, slogan or licensed typeface — the page is public.
   The display face is whatever heavy condensed italic the device already
   has, never a downloaded one.

   Kids' rules still hold: big targets (a door is never under 120px tall),
   nothing that can be got wrong, no sound, and nothing else to tap.

   One theme. A comic page does not have a light and a dark edition. */

:root {
  --ink: #14121f;
  --paper: #fff8e1;
  --yellow: #ffd60a;
  --red: #e23636;
  /* Not too dark at the foot: the ink shadows have to stay visible on it. */
  --night-1: #3447c4;
  --night-2: #2632a0;
  --night-3: #1b2278;
  --words-soft: #4a4763;
  --display: "Avenir Next Condensed", "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Impact, system-ui, sans-serif;
  --en: ui-rounded, "SF Pro Rounded", "Nunito", "Trebuchet MS", system-ui, -apple-system, "Segoe UI", sans-serif;
  --zh: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  color-scheme: dark;
}

/* Each door: the panel colour and the two shades its rays alternate between. */
.door-math   { --panel: #e23636; --ray-a: #ee4a44; --ray-b: #cf2424; }
.door-books  { --panel: #2f6fe0; --ray-a: #4484f2; --ray-b: #235cc8; }
.door-museum { --panel: #19a35b; --ray-a: #2bb86d; --ray-b: #108a49; }

* { box-sizing: border-box; }

/* .door sets its own display, which would otherwise beat the attribute. */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  background: radial-gradient(120% 85% at 50% 0%, var(--night-1) 0%, var(--night-2) 52%, var(--night-3) 100%) fixed;
  color: var(--ink);
  font-family: var(--en);
  font-size: 18px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* Halftone: printed dots that thin out from one corner, the way a comic
   shades a night sky. Behind everything and never in the way of a tap. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, .22) 2px, transparent 2.4px) 0 0 / 16px 16px;
  -webkit-mask-image: linear-gradient(135deg, #000 0%, transparent 46%, transparent 62%, rgba(0, 0, 0, .7) 100%);
          mask-image: linear-gradient(135deg, #000 0%, transparent 46%, transparent 62%, rgba(0, 0, 0, .7) 100%);
}

[lang="zh-Hant"] { font-family: var(--zh); }

.corner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  margin: auto;
  padding:
    max(30px, env(safe-area-inset-top))
    max(22px, env(safe-area-inset-right))
    max(36px, env(safe-area-inset-bottom))
    max(22px, env(safe-area-inset-left));
}

/* ---------- the title ---------- */

.hello { text-align: center; margin-bottom: clamp(26px, 5.5vh, 50px); }

.hello h1 {
  margin: 0;
  font-family: var(--display);
  font-style: italic;
  font-weight: 800;
  font-size: clamp(44px, 8.6vw, 84px);
  line-height: .95;
  letter-spacing: .01em;
  text-transform: uppercase;
  color: var(--yellow);
  rotate: -2deg;
  text-wrap: balance;
  /* An ink outline, then the letters pushed back into the page: red, then
     ink again. Shadows, not text-stroke, so old browsers keep the letters. */
  text-shadow:
    -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink),
    0 -2px 0 var(--ink), 0 2px 0 var(--ink), -2px 0 0 var(--ink), 2px 0 0 var(--ink),
    4px 4px 0 var(--red), 5px 5px 0 var(--red), 6px 6px 0 var(--red),
    7px 7px 0 var(--ink), 8px 8px 0 var(--ink);
}

/* 學習角, as a name tag clipped to the title. */
.hello-zh {
  display: inline-block;
  vertical-align: .28em;
  margin-left: .25em;
  padding: .12em .5em .16em;
  font-style: normal;
  font-size: .3em;
  font-weight: 700;
  letter-spacing: .12em;
  line-height: 1.2;
  color: var(--ink);
  text-shadow: none;
  background: #fff;
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  transform: skew(-8deg);
}

/* The question, in a comic caption box. */
.ask {
  display: inline-block;
  margin: clamp(20px, 3.4vh, 30px) 0 0;
  padding: 8px 18px 9px;
  font-size: clamp(17px, 2.4vw, 22px);
  font-weight: 700;
  color: var(--ink);
  background: var(--yellow);
  border: 3px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  rotate: 1deg;
}
.ask-zh { display: inline-block; margin-left: .4em; font-size: .92em; font-weight: 600; }

/* ---------- the doors: three comic panels ---------- */

.doors {
  display: grid;
  /* Two doors or three, the row fills itself: the book door is only there on
     a family device, and the page must not look as if one is missing. */
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: clamp(20px, 2.8vw, 34px);
  max-width: 100%;
  margin: 0 auto;
}
/* With only two, keep them from stretching into banners on a wide iPad. */
.doors:has(> .door[hidden]) { max-width: 740px; }

.door {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 120px;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 18px;
  box-shadow: 8px 8px 0 var(--ink);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  touch-action: manipulation;
  /* rotate and translate are separate properties so the tilt, the press and
     the entrance never overwrite each other. */
  rotate: -1.2deg;
  transition: translate .1s ease, box-shadow .1s ease;
}
.door-books { rotate: 1deg; }
.door-museum { rotate: -.6deg; }

/* The picture: burst rays from behind it, printed dots on top. */
.door-art {
  display: block;
  padding: clamp(14px, 2.4vw, 26px) 16px;
  border-bottom: 4px solid var(--ink);
  background:
    radial-gradient(circle, rgba(20, 18, 31, .2) 1.6px, transparent 1.9px) 0 0 / 11px 11px,
    repeating-conic-gradient(from 0deg at 50% 56%, var(--ray-a) 0 12deg, var(--ray-b) 12deg 24deg),
    var(--panel);
}
.door-art svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: clamp(120px, 26vh, 220px);
  overflow: visible;
}
.door-art .ink rect,
.door-art .ink path,
.door-art .ink circle {
  stroke: var(--ink);
  stroke-width: 3.5;
  stroke-linejoin: round;
}
.art-num {
  font-family: var(--display);
  font-style: italic;
  font-size: 44px;
  font-weight: 800;
}
.rays-under, .rays-over { fill: none; stroke-linecap: round; }
.rays-under { stroke: var(--ink); stroke-width: 9; }
.rays-over  { stroke: #ffd60a; stroke-width: 4; }

.door-words {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 16px 76px 20px 20px;
}
.door-name {
  font-family: var(--display);
  font-style: italic;
  font-weight: 800;
  font-size: clamp(29px, 3.3vw, 37px);
  line-height: 1.05;
  letter-spacing: .01em;
  text-transform: uppercase;
  color: var(--ink);
}
/* A swipe of the door's own colour under the name, like a marker. */
.door-name > span {
  background: linear-gradient(transparent 62%, color-mix(in srgb, var(--panel) 42%, transparent) 62%);
  padding: 0 .12em;
  margin: 0 -.12em;
}
.door-zh {
  margin-top: 2px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .06em;
}
.door-blurb {
  margin-top: 4px;
  font-size: 17px;
  font-weight: 600;
  color: var(--words-soft);
}

/* GO! in a burst: says "this opens" in the comic's own voice. Decoration —
   the whole door is the target. */
.door-go {
  position: absolute;
  right: 10px;
  bottom: 12px;
  width: 64px;
  height: 64px;
  rotate: -10deg;
}
.door-go svg { display: block; width: 100%; height: 100%; overflow: visible; }
.door-go polygon {
  fill: var(--yellow);
  stroke: var(--ink);
  stroke-width: 2.4;
  stroke-linejoin: round;
}
.door-go text {
  font-family: var(--display);
  font-style: italic;
  font-weight: 800;
  font-size: 14px;
  fill: var(--red);
}

@media (hover: hover) {
  .door:hover { translate: -3px -3px; box-shadow: 11px 11px 0 var(--ink); }
}
.door:active { translate: 5px 5px; box-shadow: 3px 3px 0 var(--ink); }
.door:focus-visible { outline: 4px solid var(--yellow); outline-offset: 5px; }

/* ---------- a phone held upright: picture left, words right ---------- */

@media (max-width: 599px) {
  .hello h1 { text-shadow:
    -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink),
    0 -2px 0 var(--ink), 0 2px 0 var(--ink), -2px 0 0 var(--ink), 2px 0 0 var(--ink),
    3px 3px 0 var(--red), 4px 4px 0 var(--red), 5px 5px 0 var(--ink), 6px 6px 0 var(--ink); }
  .doors { grid-template-columns: 1fr; gap: 18px; }
  .door { flex-direction: row; align-items: stretch; box-shadow: 6px 6px 0 var(--ink); rotate: -.8deg; }
  .door-books { rotate: .7deg; }
  .door-museum { rotate: -.4deg; }
  .door-art {
    flex: 0 0 34%;
    max-width: 150px;
    display: grid;
    place-items: center;
    padding: 12px 8px;
    border-bottom: 0;
    border-right: 4px solid var(--ink);
  }
  .door-words { flex: 1; justify-content: center; padding: 14px 58px 14px 14px; }
  /* Small enough that "Museum Trip" stays on one line on a 375px phone. */
  .door-name { font-size: 23px; }
  .door-zh, .door-blurb { font-size: 15.5px; }
  .door-go { right: 6px; bottom: 50%; translate: 0 50%; width: 52px; height: 52px; }
}

/* ---------- arriving ---------- */

@media (prefers-reduced-motion: no-preference) {
  .door { animation: land .42s cubic-bezier(.2, 1.4, .4, 1) backwards; }
  .door:nth-child(1) { animation-delay: .06s; }
  .door:nth-child(2) { animation-delay: .14s; }
  .door:nth-child(3) { animation-delay: .22s; }
  /* Size only, never opacity: a browser that pauses animations (a tab opened
     in the background does) must still show every door. */
  @keyframes land {
    from { scale: .88; }
    to   { scale: 1; }
  }
}
@media (prefers-reduced-motion: reduce) {
  .door { transition: none; }
}
