/* The Softwired Advent · site styles
   The soft scrapbook look on kraft paper (locked Nov 29, carousel 05): pale torn strips (cream, blush, butter),
   Instrument Serif in burgundy/raspberry with italic key words, DM Sans labels, Shadows Into Light Two handwriting,
   a few small stars, the pink wire. Fonts are self-hosted (OFL); nothing loads from another site. */

@font-face { font-family: "DM Sans"; src: url("fonts/DMSans-Variable.woff2") format("woff2"); font-weight: 100 1000; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("fonts/InstrumentSerif-Regular.woff2") format("woff2"); font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("fonts/InstrumentSerif-Italic.woff2") format("woff2"); font-style: italic; font-display: swap; }
@font-face { font-family: "Shadows Into Light Two"; src: url("fonts/ShadowsIntoLightTwo-Regular.woff2") format("woff2"); font-display: swap; }

:root {
  color-scheme: light;
  --kraft: #DCCFBD; --kraft-dk: #A8927B; --kraft-line: #C9B9A3;
  --cream: #FBF5EA; --blush: #F5CFD8; --butter: #F6E9B0; --gold: #E8C766;
  --ras: #B8325F; --bur: #7A1F3D; --hand: #9E2F55; --pink: #EC5C93; --src: #5E4F45;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "DM Sans", system-ui, -apple-system, sans-serif;
  --script: "Shadows Into Light Two", "Segoe Print", cursive;
  --shadow: drop-shadow(0 2px 3px rgba(94, 79, 69, .18));
  --torn-a: polygon(0.0% 0.9px, 3.8% 0.4px, 7.7% 1.6px, 11.5% 0.6px, 15.4% 0.3px, 19.2% 1.6px, 23.1% 3.7px, 26.9% 3.2px, 30.8% 3.1px, 34.6% 0.9px, 38.5% 2.1px, 42.3% 1.1px, 46.2% 0.7px, 50.0% 0.4px, 53.8% 0.9px, 57.7% 3.7px, 61.5% 3.3px, 65.4% 3.2px, 69.2% 3.2px, 73.1% 0.8px, 76.9% 1.2px, 80.8% 2.5px, 84.6% 2.9px, 88.5% 3.4px, 92.3% 3.5px, 96.2% 0.3px, 100.0% 2.4px, calc(100% - 2.7px) 16.7%, calc(100% - 2.0px) 33.3%, calc(100% - 0.7px) 50.0%, calc(100% - 1.9px) 66.7%, calc(100% - 0.4px) 83.3%, 100.0% calc(100% - 3.7px), 96.2% calc(100% - 3.5px), 92.3% calc(100% - 2.2px), 88.5% calc(100% - 1.2px), 84.6% calc(100% - 3.6px), 80.8% calc(100% - 2.3px), 76.9% calc(100% - 3.5px), 73.1% calc(100% - 3.4px), 69.2% calc(100% - 2.0px), 65.4% calc(100% - 1.7px), 61.5% calc(100% - 2.4px), 57.7% calc(100% - 1.7px), 53.8% calc(100% - 0.6px), 50.0% calc(100% - 1.2px), 46.2% calc(100% - 3.3px), 42.3% calc(100% - 0.2px), 38.5% calc(100% - 0.2px), 34.6% calc(100% - 2.5px), 30.8% calc(100% - 1.1px), 26.9% calc(100% - 2.1px), 23.1% calc(100% - 1.9px), 19.2% calc(100% - 1.4px), 15.4% calc(100% - 4.0px), 11.5% calc(100% - 0.8px), 7.7% calc(100% - 1.7px), 3.8% calc(100% - 0.8px), 0.0% calc(100% - 2.5px), 1.1px 83.3%, 1.4px 66.7%, 3.0px 50.0%, 1.3px 33.3%, 2.2px 16.7%);
  --torn-b: polygon(0.0% 1.9px, 3.8% 1.5px, 7.7% 0.6px, 11.5% 3.5px, 15.4% 0.0px, 19.2% 2.0px, 23.1% 3.6px, 26.9% 0.3px, 30.8% 2.2px, 34.6% 2.5px, 38.5% 0.2px, 42.3% 1.5px, 46.2% 2.8px, 50.0% 1.8px, 53.8% 2.9px, 57.7% 0.6px, 61.5% 1.0px, 65.4% 0.4px, 69.2% 2.0px, 73.1% 3.7px, 76.9% 2.4px, 80.8% 3.1px, 84.6% 1.5px, 88.5% 3.0px, 92.3% 0.4px, 96.2% 1.2px, 100.0% 2.7px, calc(100% - 2.9px) 16.7%, calc(100% - 1.7px) 33.3%, calc(100% - 0.4px) 50.0%, calc(100% - 1.1px) 66.7%, calc(100% - 0.8px) 83.3%, 100.0% calc(100% - 1.1px), 96.2% calc(100% - 3.2px), 92.3% calc(100% - 0.8px), 88.5% calc(100% - 3.5px), 84.6% calc(100% - 3.5px), 80.8% calc(100% - 0.2px), 76.9% calc(100% - 1.5px), 73.1% calc(100% - 2.0px), 69.2% calc(100% - 0.1px), 65.4% calc(100% - 1.7px), 61.5% calc(100% - 3.6px), 57.7% calc(100% - 0.4px), 53.8% calc(100% - 2.4px), 50.0% calc(100% - 0.5px), 46.2% calc(100% - 2.3px), 42.3% calc(100% - 3.6px), 38.5% calc(100% - 0.8px), 34.6% calc(100% - 0.0px), 30.8% calc(100% - 0.3px), 26.9% calc(100% - 2.2px), 23.1% calc(100% - 0.1px), 19.2% calc(100% - 0.3px), 15.4% calc(100% - 2.0px), 11.5% calc(100% - 3.7px), 7.7% calc(100% - 1.7px), 3.8% calc(100% - 1.6px), 0.0% calc(100% - 2.6px), 0.4px 83.3%, 2.3px 66.7%, 0.7px 50.0%, 2.4px 33.3%, 3.8px 16.7%);
  --torn-c: polygon(0.0% 1.0px, 3.8% 2.7px, 7.7% 2.7px, 11.5% 3.4px, 15.4% 0.7px, 19.2% 0.9px, 23.1% 0.6px, 26.9% 0.9px, 30.8% 2.9px, 34.6% 0.5px, 38.5% 2.1px, 42.3% 0.9px, 46.2% 1.2px, 50.0% 1.7px, 53.8% 3.4px, 57.7% 2.4px, 61.5% 0.1px, 65.4% 1.1px, 69.2% 0.6px, 73.1% 3.5px, 76.9% 3.2px, 80.8% 3.2px, 84.6% 3.3px, 88.5% 3.0px, 92.3% 3.8px, 96.2% 3.2px, 100.0% 1.0px, calc(100% - 3.4px) 16.7%, calc(100% - 1.9px) 33.3%, calc(100% - 3.0px) 50.0%, calc(100% - 2.3px) 66.7%, calc(100% - 1.7px) 83.3%, 100.0% calc(100% - 1.5px), 96.2% calc(100% - 1.7px), 92.3% calc(100% - 1.3px), 88.5% calc(100% - 0.5px), 84.6% calc(100% - 3.3px), 80.8% calc(100% - 3.2px), 76.9% calc(100% - 3.9px), 73.1% calc(100% - 2.8px), 69.2% calc(100% - 2.2px), 65.4% calc(100% - 3.0px), 61.5% calc(100% - 0.5px), 57.7% calc(100% - 2.7px), 53.8% calc(100% - 1.8px), 50.0% calc(100% - 0.7px), 46.2% calc(100% - 0.8px), 42.3% calc(100% - 2.1px), 38.5% calc(100% - 1.0px), 34.6% calc(100% - 1.8px), 30.8% calc(100% - 2.4px), 26.9% calc(100% - 1.6px), 23.1% calc(100% - 0.5px), 19.2% calc(100% - 2.0px), 15.4% calc(100% - 0.9px), 11.5% calc(100% - 0.9px), 7.7% calc(100% - 0.8px), 3.8% calc(100% - 1.5px), 0.0% calc(100% - 0.3px), 2.6px 83.3%, 3.8px 66.7%, 1.6px 50.0%, 2.9px 33.3%, 3.7px 16.7%);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--bur); font-family: var(--sans); font-size: 17px; line-height: 1.55;
  background-color: var(--kraft);
  /* paper grain: SVG noise, drawn in the browser, nothing downloaded */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .37 0 0 0 0 .31 0 0 0 0 .27 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  overflow-x: hidden;
}
a { color: var(--ras); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; border-radius: 4px; }
em, i { font-style: italic; }

.page { max-width: 760px; margin: 0 auto; padding: 0 16px 24px; }

/* top bar: the handle, like every carousel slide */
.topbar { display: flex; align-items: center; gap: 14px; padding: 20px 4px 8px; font-weight: 600; font-size: 15px; color: var(--src); }
.topbar > :first-child { margin-right: auto; }
.topbar a { color: var(--src); text-decoration: none; }
.topbar a:hover { color: var(--ras); }

/* labels: DM Sans caps, wide spacing */
.label { font-family: var(--sans); font-weight: 650; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--hand); margin: 0; }
.hand { font-family: var(--script); color: var(--hand); font-size: 22px; line-height: 1.3; }

/* torn paper strips */
.strip-wrap { display: inline-block; filter: var(--shadow); }
.strip { display: inline-block; background: var(--cream); clip-path: var(--torn-a); padding: .08em .38em .14em; }
.strip.blush { background: var(--blush); clip-path: var(--torn-b); }
.strip.butter { background: var(--butter); clip-path: var(--torn-c); }
.strip.cream { background: var(--cream); }
.tilt-l { transform: rotate(-1.6deg); } .tilt-r { transform: rotate(1.3deg); } .tilt-s { transform: rotate(-.6deg); }

.serif { font-family: var(--serif); font-weight: 400; line-height: 1.05; }
.serif em { color: var(--ras); }

/* hero */
.hero { position: relative; text-align: center; padding: 26px 0 8px; }
.hero h1 { margin: 14px 0 0; font-size: clamp(42px, 11.5vw, 78px); }
.hero h1 .row { display: block; margin: -0.02em 0; }
.hero .hand.note { margin: 18px auto 0; max-width: 30ch; transform: rotate(-1.5deg); }
.tape { position: absolute; width: 92px; height: 24px; background: var(--butter); opacity: .9; clip-path: var(--torn-c); }

/* stars */
.star { position: absolute; z-index: 2; width: 22px; height: 22px; color: var(--pink); }
.star.gold { color: var(--gold); }
.star svg { width: 100%; height: 100%; display: block; }

/* behind today's door: the first thing people from Instagram need */
.today-card { text-align: center; margin: 30px 0 0; }
.today-card .strip-wrap { margin-top: 10px; }
.today-card .strip { font-family: var(--serif); font-size: clamp(30px, 8vw, 44px); line-height: 1.05; }
.today-card .strip em { color: var(--ras); }
.today-card .open-link { display: inline-block; margin-top: 14px; font-family: var(--script); font-size: 22px; color: #fff; background: var(--ras); border-radius: 999px; padding: 3px 22px 6px; text-decoration: none; }
.today-card .open-link:hover { background: var(--bur); }
.today-card .hand { margin: 10px 0 0; }

/* the calendar: one board, 24 paper doors, coloured by part */
.calendar { position: relative; margin: 40px 0 0; padding: 26px 18px 22px 24px; background: rgba(120, 92, 62, .12); border-radius: 10px; box-shadow: inset 0 0 0 1.5px rgba(122, 31, 61, .08), inset 0 2px 10px rgba(94, 79, 69, .12); }
.calendar > .label { text-align: center; margin: 0 0 18px; }
.calendar .tape { top: -11px; }
.cal-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 14px; }
.cd { position: relative; min-width: 0; aspect-ratio: 4 / 5; perspective: 700px; }
.cd:nth-child(4n+1) { transform: rotate(-.9deg); } .cd:nth-child(4n+2) { transform: rotate(.6deg); } .cd:nth-child(4n+3) { transform: rotate(-.3deg); } .cd:nth-child(4n) { transform: rotate(.9deg); }
/* behind the door */
.cd .behind { position: absolute; inset: 0; border-radius: 3px; background: #FFFDF8; box-shadow: inset 0 2px 7px rgba(94, 79, 69, .38); padding: 9px 8px 8px 10px; display: flex; flex-direction: column; justify-content: space-between; text-decoration: none; color: var(--bur); overflow: hidden; }
.cd .behind .s { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--hand); }
.cd .behind .t { font-family: var(--serif); font-size: 17px; line-height: 1.02; }
.cd .behind .t em { color: var(--ras); }
.cd .behind .go { font-family: var(--script); font-size: 16px; color: var(--ras); line-height: 1; }
.cd a.behind:hover .go { color: var(--pink); }
/* the door itself: a paper flap on a hinge at its left edge */
.cd .flap { position: absolute; inset: 0; transform-origin: left center; transition: transform 1.1s cubic-bezier(.3, .75, .25, 1); filter: drop-shadow(0 2px 3px rgba(94, 79, 69, .25)); }
.cd.open .flap { transform: rotateY(-108deg); pointer-events: none; }
/* no 3D back faces (Safari draws them wrong): the flap switches to its plain back once it has swung past halfway */
.cd .face { position: absolute; inset: 0; }
.cd .face .paper { position: absolute; inset: 0; clip-path: var(--torn-a); background: var(--cream); padding: 10px 10px 9px 12px; display: flex; flex-direction: column; justify-content: space-between; }
.cd .face.front .paper::before { content: ""; position: absolute; inset: 7px; border: 1.5px dashed rgba(122, 31, 61, .24); border-radius: 3px; }
.cd .face.front .paper::after { content: ""; position: absolute; right: 13px; top: 54%; width: 7px; height: 7px; border-radius: 50%; background: var(--kraft-dk); }
.cd .face.back { visibility: hidden; }
.cd.open .face.front { visibility: hidden; transition: visibility 0s .4s; }
.cd.open .face.back { visibility: visible; transition: visibility 0s .4s; }
.cd .face.back .paper { background: #EFE5D6; }
.cd .num { font-family: var(--serif); font-size: 38px; line-height: 1; color: var(--bur); position: relative; }
.cd .when { font-size: 11.5px; font-weight: 650; color: var(--src); position: relative; }
.cd.is-next .when { color: var(--ras); }
/* the parts */
.cd.p2 .face .paper { background: var(--blush); clip-path: var(--torn-b); }
.cd.p3 .face .paper { background: var(--butter); clip-path: var(--torn-c); }
.cd.p4 .face.front .paper { background: var(--ras); }
.cd.p4 .face.back .paper { background: #E7C2CF; }
.cd.p4 .num, .cd.p4 .when { color: var(--cream); }
.cd.p4 .face.front .paper::before { border-color: rgba(251, 245, 234, .45); }
.cd.p4 .face.front .paper::after { background: var(--cream); }
.cd .sticker { position: absolute; top: -21px; right: -10px; z-index: 3; font-family: var(--script); font-size: 17px; color: #fff; background: var(--pink); padding: 1px 11px 3px; border-radius: 999px; transform: rotate(5deg); }
.cd .eve-star { position: absolute; z-index: 3; top: -12px; right: -9px; width: 30px; height: 30px; color: var(--gold); filter: drop-shadow(0 1px 2px rgba(94, 79, 69, .3)); transform: rotate(12deg); }
.cd .eve-star svg { width: 100%; height: 100%; display: block; }

/* the key to the parts */
.legend { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 14px; }
.legend li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; }
.legend .chip { width: 26px; height: 32px; margin-top: 2px; border-radius: 2px; box-shadow: 0 1px 3px rgba(94, 79, 69, .3); background: var(--cream); }
.legend .chip.p2 { background: var(--blush); } .legend .chip.p3 { background: var(--butter); } .legend .chip.p4 { background: var(--ras); }
.legend .name { font-family: var(--serif); font-size: 26px; line-height: 1.05; }
.legend .name em { color: var(--ras); }
.legend .meta { display: block; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--hand); margin-top: 3px; }
.legend .hand { display: block; font-size: 19px; margin-top: 2px; }

/* snow: one canvas above the page that ignores clicks, and its switch */
.snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; }
.snow-toggle { display: inline-flex; align-items: center; gap: 5px; font: inherit; color: var(--src); background: rgba(251, 245, 234, .65); border: 0; border-radius: 999px; padding: 3px 11px 3px 8px; cursor: pointer; position: relative; z-index: 11; }
.snow-toggle svg { width: 16px; height: 16px; }
.snow-toggle[aria-pressed="true"] { color: var(--ras); }
.snow-toggle[aria-pressed="false"] span { text-decoration: line-through; text-decoration-thickness: 1.5px; }

/* footer: the wire */
.wire { display: flex; height: 46px; margin-top: 54px; }
.wire svg { display: block; height: 46px; }
.wire .loops { width: 56px; flex: none; }
.wire .loops.left { transform: scaleX(-1); }
.wire .line { flex: 1; width: auto; min-width: 0; }
.wire path { fill: none; stroke: var(--pink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.footer { text-align: center; padding: 6px 0 36px; color: var(--src); }
.footer .signoff { font-family: var(--serif); font-size: 38px; color: var(--bur); margin: 0; }
.footer .signoff em { color: var(--ras); }
.footer p { margin: 8px 0 0; font-size: 15px; }
.footer .small { font-size: 13px; color: var(--src); opacity: .9; }

/* door page */
.door-hero { text-align: center; padding: 18px 0 6px; position: relative; }
.door-hero h1 { margin: 14px 0 0; font-size: clamp(44px, 12vw, 80px); }
.door-hero .result { margin: 18px auto 0; max-width: 32ch; transform: rotate(-1deg); }
.section { margin-top: 40px; }
.section > h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 7.5vw, 40px); margin: 0 0 14px; line-height: 1.05; }
.section > h2 em { color: var(--ras); }
.note { position: relative; filter: var(--shadow); }
.note > .paper { background: var(--cream); clip-path: var(--torn-a); padding: 22px 22px 20px; }
.note.blush > .paper { background: var(--blush); clip-path: var(--torn-b); }
.note.butter > .paper { background: var(--butter); clip-path: var(--torn-c); }
.steps { counter-reset: s; list-style: none; margin: 0; padding: 0; }
.steps li { counter-increment: s; position: relative; padding: 0 0 14px 46px; }
.steps li:last-child { padding-bottom: 0; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: -6px; font-family: var(--serif); font-style: italic; font-size: 34px; color: var(--ras); line-height: 1; }
.prompt { font-family: var(--sans); font-size: 16.5px; line-height: 1.6; color: #4a1830; margin: 0; white-space: pre-wrap; }
.prompt .fill { background: rgba(236, 92, 147, .16); border-radius: 4px; padding: 0 3px; color: var(--ras); font-weight: 600; }
.example-label { display: block; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--hand); margin-bottom: 8px; }
.copy { margin-top: 16px; font-family: var(--script); font-size: 21px; color: #fff; background: var(--ras); border: 0; border-radius: 999px; padding: 4px 20px 6px; cursor: pointer; }
.copy:hover { background: var(--bur); }
.tip { font-family: var(--serif); font-size: clamp(24px, 6vw, 30px); line-height: 1.18; margin: 6px 0 0; }
.tip em { color: var(--ras); }
.ways { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.ways .level { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--hand); margin-bottom: 2px; }
.ways h3 { font-family: var(--serif); font-weight: 400; font-size: 26px; margin: 0; line-height: 1.1; }
.ways p { margin: 4px 0 0; }
.tags { display: flex; flex-wrap: wrap; gap: 8px 10px; margin: 0; padding: 0; list-style: none; }
.tags li { font-family: var(--script); font-size: 20px; color: var(--hand); background: var(--cream); padding: 2px 14px 4px; border-radius: 999px; filter: var(--shadow); }
.sources { margin-top: 38px; font-size: 13.5px; color: var(--src); }
.sources a { color: var(--src); }
.up-next { margin-top: 44px; text-align: center; }
.up-next .serif { font-size: clamp(28px, 7vw, 38px); margin: 8px 0 0; }
.up-next .serif em { color: var(--ras); }
.back { display: inline-block; margin-top: 18px; font-family: var(--script); font-size: 22px; color: var(--hand); text-decoration: none; }
.back:hover { color: var(--pink); }
.not-yet { text-align: center; padding: 60px 0 10px; }
.not-yet .serif { font-size: clamp(40px, 11vw, 64px); margin: 12px 0 0; }

@media (min-width: 640px) {
  body { font-size: 18px; }
  .cal-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .legend { grid-template-columns: 1fr 1fr; gap: 18px 26px; }
}
@media (min-width: 720px) {
  .cal-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px 16px; }
  .cd .num { font-size: 42px; }
  .cd .behind .t { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .cd .flap { transition: none; }
}
