/* How it works page (how-it-works.html, founder 2026-10-06/07): the 9 steps to build and publish a website in
   the Code Lab, one picture each. (how-it-works.css is the homepage's class section, a different thing.)
   Full width (founder 2026-10-07: "make sure the page is full container width"): side gutters only, no centred box.
   Every picture opens the viewer (how-it-works-page.js). */
:root { --hw-gut: clamp(16px, 3vw, 48px); --hw-red: #e11d48; }

/* ----- Top of the page ----- */
.hw-hero { position: relative; overflow: hidden; text-align: left; padding: 56px var(--hw-gut) 64px;
  background:
    radial-gradient(900px 420px at 12% 0%, rgba(37, 99, 235, 0.32), transparent 65%),
    radial-gradient(700px 420px at 92% 30%, rgba(225, 29, 72, 0.22), transparent 65%),
    linear-gradient(180deg, #070b1d 0%, #0a1030 100%);
  border-bottom: 1px solid var(--border); }
.hw-hero::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.35;
  background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: linear-gradient(180deg, #000 0%, transparent 85%); -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%); }
.hw-hero-in { position: relative; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(28px, 4vw, 64px); align-items: center; }
.hw-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: #fde68a; background: rgba(250, 204, 21, 0.1); border: 1px solid rgba(250, 204, 21, 0.35); }
.hw-pill svg { width: 15px; height: 15px; }
.hw-hero h1 { margin: 18px 0 16px; font-size: clamp(2.1rem, 4.6vw, 3.7rem); line-height: 1.06; letter-spacing: -0.02em; }
.hw-grad { background: linear-gradient(90deg, #60a5fa 0%, #a78bfa 50%, #f472b6 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hw-lede { max-width: 620px; margin: 0; font-size: clamp(1.02rem, 1.4vw, 1.18rem); line-height: 1.65; color: var(--text-muted); }
.hw-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.hw-btn { display: inline-flex; align-items: center; gap: 10px; padding: 14px 22px; font-size: 1rem; }
.hw-btn svg { width: 20px; height: 20px; flex: none; }
.hw-facts { list-style: none; display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 26px 0 0; padding: 0; color: var(--text); font-size: 0.92rem; font-weight: 600; }
.hw-facts li { display: inline-flex; align-items: center; gap: 8px; }
.hw-facts svg { width: 18px; height: 18px; padding: 3px; color: #fff; background: #16a34a; }
/* Three step pictures, fanned out */
.hw-hero-art { position: relative; aspect-ratio: 5 / 4; min-height: 260px; }
.hw-hero-art .hw-fan { position: absolute; width: 74%; display: block; /* beats .hw-zoom { position: relative } further down */ box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.12);
  transition: transform 0.35s ease, z-index 0s; cursor: zoom-in; }
.hw-fan img { display: block; width: 100%; height: auto; }
.hw-fan-1 { left: 0; top: 4%; transform: rotate(-7deg); z-index: 1; }
.hw-fan-2 { right: 0; top: 0; transform: rotate(5deg); z-index: 2; }
.hw-fan-3 { left: 13%; bottom: 0; transform: rotate(-1deg); z-index: 3; }
.hw-fan:hover, .hw-fan:focus-visible { transform: rotate(0) scale(1.04); z-index: 4; outline: none; }
.hw-hero-tag { position: absolute; right: 2%; bottom: -6px; z-index: 5; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; font-size: 0.85rem; font-weight: 700;
  color: #0a0e1a; background: #facc15; box-shadow: 0 10px 24px -8px rgba(250, 204, 21, 0.6); }
.hw-hero-tag b { display: inline-grid; place-items: center; width: 24px; height: 24px; color: #fff; background: var(--hw-red); }

/* ----- The steps, full width ----- */
.hw-wrap { padding: 34px var(--hw-gut) 80px; }
.hw-toc ol { list-style: none; margin: 0 0 34px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.hw-toc a { display: flex; align-items: center; gap: 10px; height: 100%; padding: 10px 12px; color: var(--text); text-decoration: none; font-size: 0.9rem; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); transition: border-color 0.15s ease, transform 0.15s ease; }
.hw-toc a:hover, .hw-toc a:focus-visible { border-color: var(--accent); transform: translateY(-2px); }
.hw-toc b { display: inline-grid; place-items: center; width: 26px; height: 26px; flex: none; font-size: 0.85rem; color: #fff; background: var(--hw-red); }
.hw-steps { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.hw-step { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(22px, 3vw, 48px); align-items: center; padding: clamp(14px, 2vw, 26px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)), var(--surface); border: 1px solid var(--border); scroll-margin-top: 90px; }
.hw-step:nth-child(even) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
.hw-step:nth-child(even) .hw-pic { order: 2; }
.hw-step > * { min-width: 0; }
.hw-pic { margin: 0; }
.hw-zoom { position: relative; display: block; cursor: zoom-in; }
.hw-pic img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; background: var(--code-bg, #0b1022); transition: filter 0.2s ease; }
.hw-zoom-hint { position: absolute; right: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; font-size: 0.8rem; font-weight: 700;
  color: #fff; background: rgba(5, 8, 20, 0.78); border: 1px solid rgba(255, 255, 255, 0.2); opacity: 0.92; transition: opacity 0.2s ease, transform 0.2s ease; }
.hw-zoom-hint svg { width: 16px; height: 16px; }
.hw-zoom:hover img { filter: brightness(1.06); }
.hw-zoom:hover .hw-zoom-hint, .hw-zoom:focus-visible .hw-zoom-hint { opacity: 1; transform: translateY(-2px); }
.hw-text { min-width: 0; }
.hw-num { display: inline-grid; place-items: center; width: 44px; height: 44px; margin-bottom: 12px; font: 800 1.25rem/1 var(--font-head, inherit); color: #fff; background: var(--hw-red); }
.hw-text h2 { font-size: clamp(1.3rem, 2.1vw, 1.8rem); line-height: 1.22; margin: 0 0 12px; }
.hw-text p { margin: 0 0 12px; color: var(--text-muted); line-height: 1.7; font-size: 1.02rem; }
.hw-text p strong { color: var(--text); }
.hw-text code { font-size: 0.88em; padding: 1px 6px; background: var(--code-bg, #0b1022); border: 1px solid var(--border); color: var(--text); overflow-wrap: anywhere; }
.hw-prompt { margin: 4px 0 14px; padding: 14px 16px; background: var(--code-bg, #0b1022); border: 1px solid var(--border); border-left: 3px solid var(--accent); }
.hw-prompt p { margin: 0 0 10px; color: var(--text); font-style: italic; }
.hw-copy { font: inherit; font-size: 0.82rem; font-weight: 600; padding: 6px 12px; color: var(--text); background: var(--surface); border: 1px solid var(--border); cursor: pointer; }
.hw-copy:hover, .hw-copy:focus-visible { border-color: var(--accent); }
.hw-tip { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; color: var(--text) !important; background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.35); }
.hw-tip-ic { display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; margin-top: 2px; color: #fff; background: #16a34a; }
.hw-tip-ic svg { width: 14px; height: 14px; }
.hw-done { display: flex; align-items: center; gap: 20px; margin-top: 36px; padding: clamp(18px, 2.5vw, 30px);
  background: radial-gradient(600px 200px at 0% 0%, rgba(250, 204, 21, 0.12), transparent 70%), var(--surface); border: 1px solid var(--accent); }
.hw-done-ic { display: inline-grid; place-items: center; width: 56px; height: 56px; flex: none; color: #facc15; background: rgba(250, 204, 21, 0.12); }
.hw-done-ic svg { width: 28px; height: 28px; }
.hw-done h2 { margin: 0 0 6px; font-size: 1.35rem; }
.hw-done p { margin: 0; color: var(--text-muted); }
.hw-done > div { flex: 1 1 auto; min-width: 0; }
/* True circles stay round (square.css squares everything else; its rule is :where() + !important, so this wins). */
.hw-num, .hw-toc b, .hw-tip-ic, .hw-done-ic { border-radius: 50% !important; }

/* ----- The picture viewer ----- */
.hw-lb { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; color: #fff; background: #03050e !important; overflow: hidden; } /* solid: the page must not show through */
.hw-lb::backdrop { background: rgba(3, 5, 14, 0.6); }
html:has(.hw-lb[open]) { overflow: hidden; }
.hw-lb-stage { position: absolute; inset: 64px 72px 72px; display: grid; place-items: center; overflow: auto; overscroll-behavior: contain; touch-action: pan-x pan-y pinch-zoom; }
.hw-lb-stage img { max-width: 100%; max-height: 100%; width: auto; height: auto; cursor: zoom-in; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); user-select: none; -webkit-user-drag: none; }
.hw-lb.is-zoomed .hw-lb-stage { place-items: start; }
.hw-lb.is-zoomed .hw-lb-stage img { max-width: none; max-height: none; width: min(1536px, 180vw); cursor: zoom-out; }
.hw-lb-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.hw-lb-title { font-weight: 700; font-size: 0.98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hw-lb-title b { color: #facc15; margin-right: 6px; }
.hw-lb-tools { display: flex; gap: 8px; flex: none; }
.hw-lb button { display: inline-grid; place-items: center; width: 44px; height: 44px; color: #fff; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.22); cursor: pointer; }
.hw-lb button:hover, .hw-lb button:focus-visible { background: rgba(255, 255, 255, 0.2); outline: none; }
.hw-lb button svg { width: 22px; height: 22px; }
.hw-lb-prev, .hw-lb-next { position: absolute; top: 50%; transform: translateY(-50%); width: 52px !important; height: 52px !important; }
.hw-lb-prev { left: 12px; } .hw-lb-next { right: 12px; }
.hw-lb-foot { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 16px 18px; text-align: center; font-size: 0.85rem; color: rgba(255, 255, 255, 0.75); }

@media (max-width: 960px) {
  .hw-hero { padding-top: 36px; padding-bottom: 48px; }
  .hw-hero-in { grid-template-columns: minmax(0, 1fr); }
  .hw-hero-art { max-width: 560px; width: 100%; margin: 6px auto 0; }
  .hw-step, .hw-step:nth-child(even) { display: flex; flex-direction: column; align-items: stretch; gap: 16px; }
  .hw-text { order: -1; } /* on phones the step (number, title, words) comes first, then its picture */
  .hw-step:nth-child(even) .hw-pic { order: 0; }
  .hw-done { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 640px) {
  .hw-lb-stage { inset: 60px 8px 64px; }
  .hw-lb-prev, .hw-lb-next { top: auto; bottom: 10px; transform: none; width: 46px !important; height: 46px !important; }
  .hw-lb-foot { padding: 0 66px 22px; font-size: 0.78rem; line-height: 1.35; } /* between the two arrow buttons */
  .hw-zoom-hint { right: 8px; bottom: 8px; padding: 5px 9px; font-size: 0.74rem; }
  .hw-cta .hw-btn { flex: 1 1 100%; justify-content: center; }
}
@media (max-width: 560px) { .hw-toc ol { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .hw-fan, .hw-toc a, .hw-zoom-hint { transition: none; } }
