/* Noterat — home page */

h2 { font: 500 clamp(2rem, 4.2vw, 3rem)/1.05 var(--serif); letter-spacing: -0.025em; margin: 0 0 1rem; font-variation-settings: "opsz" 144; }
.small { font-size: 0.9rem; color: var(--ink-soft); }
.fig-no { color: var(--pencil); margin: 0 0 0.9rem; }

/* ---------- shared "paper" props ---------- */
.sheet {
  position: relative;
  margin: 0;
  background: var(--panel);
  padding: 10px;
  border-radius: 3px;
  box-shadow: var(--shadow);
}
.sheet img { border-radius: 2px; }
.tilt-r { transform: rotate(0.9deg); }
.tilt-l { transform: rotate(-0.8deg); }
.tilt-r2 { transform: rotate(0.5deg); }

.tape {
  position: absolute;
  width: 112px; height: 30px;
  background: color-mix(in srgb, var(--wood) 78%, transparent);
  box-shadow: 0 1px 2px rgba(16,40,79,.12);
  z-index: 3;
  /* torn ends */
  -webkit-mask: linear-gradient(90deg, transparent 0, #000 4px calc(100% - 4px), transparent 100%),
                repeating-linear-gradient(0deg, #000 0 3px, transparent 3px 5px);
  -webkit-mask-composite: source-over;
  mask: linear-gradient(90deg, transparent 0, #000 5px calc(100% - 5px), transparent 100%);
}
@media (prefers-color-scheme: dark) { .tape { background: color-mix(in srgb, var(--wood) 55%, transparent); } }
.tape-tl { top: -12px; left: -26px; transform: rotate(-32deg); }
.tape-tr { top: -12px; right: -26px; transform: rotate(30deg); }
.tape-tc { top: -15px; left: 50%; transform: translateX(-50%) rotate(-3deg); }
.tape-br { bottom: -12px; right: -24px; transform: rotate(-28deg); }

/* hand-written annotations */
.annot {
  position: absolute;
  left: var(--x); top: var(--y);
  margin: 0;
  font-size: clamp(1.3rem, 2vw, 1.7rem);
  line-height: 1;
  color: var(--pencil);
  white-space: nowrap;
  display: flex; align-items: center; gap: 0.35rem;
  z-index: 4;
  transform: rotate(-3deg);
  pointer-events: none;
}
.annot svg, .note-free svg, .ring svg, .scribble-under svg { overflow: visible; }
.annot svg path, .note-free svg path, .ring path {
  fill: none; stroke: var(--pencil); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
}
.annot .arrow-left { width: 64px; height: 32px; }
.annot-below { transform: translateX(-50%) rotate(-2deg); }
.ring { position: absolute; left: var(--x); top: var(--y); width: 30%; transform: translate(-50%, -50%) rotate(-3deg); z-index: 4; pointer-events: none; }
.ring svg { width: 100%; height: auto; }

/* drawn-in strokes */
.draw path { stroke-dasharray: var(--len, 600); stroke-dashoffset: var(--len, 600); transition: stroke-dashoffset 1.1s cubic-bezier(.6,.1,.3,1) var(--delay, 0s); }
.draw.is-in path { stroke-dashoffset: 0; }
@media (prefers-reduced-motion: reduce) { .draw path { transition: none; stroke-dashoffset: 0; } }

/* ---------- HERO ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  padding-top: clamp(3rem, 7vw, 6rem);
  padding-bottom: clamp(3rem, 6vw, 5rem);
}
.kicker { color: var(--pencil); margin: 0 0 1.4rem; }
.display {
  font: 400 clamp(2.6rem, 5.6vw, 5rem)/0.98 var(--serif);
  letter-spacing: -0.035em;
  margin: 0 0 1.6rem;
  font-variation-settings: "opsz" 144;
}
.display em { font-style: italic; font-weight: 300; color: var(--navy); }
@media (prefers-color-scheme: dark) { .display em { color: var(--coral); } }
.scribble-under { position: relative; white-space: nowrap; }
.scribble-under svg { position: absolute; left: -2%; right: 0; bottom: -0.08em; width: 104%; height: 0.28em; }
.scribble-under path { fill: none; stroke: var(--coral); stroke-width: 7; stroke-linecap: round; }
.lede { font-size: clamp(1.08rem, 1.6vw, 1.22rem); color: var(--ink-soft); max-width: 31rem; margin: 0 0 2rem; }
.cta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.note-free { font-size: 1.75rem; color: var(--pencil); display: inline-flex; align-items: flex-end; gap: 0.1rem; transform: rotate(-4deg) translateY(10px); }
.note-free svg { width: 54px; height: 32px; }
.meta { color: var(--ink-soft); margin: 1.5rem 0 0; }

.hero-stage { position: relative; padding: 1.5rem 0 2.5rem 1.5rem; }
.sheet-ipad { transform: rotate(1.6deg); }
.phone {
  position: absolute;
  left: -9%; bottom: -3.5rem;
  width: 23%;
  margin: 0;
  background: #0a0f1a;
  padding: 6px;
  border-radius: 30px;
  transform: rotate(-5deg);
  box-shadow: 0 30px 50px -24px rgba(16,40,79,.55), 0 0 0 1px rgba(255,255,255,.06) inset;
  z-index: 5;
}
.phone img { border-radius: 24px; }
.annot-hero { position: absolute; right: 2%; top: -1.4rem; left: auto; flex-direction: row; align-items: flex-start; }
.annot-hero svg { width: 60px; height: 46px; margin-top: 0.6rem; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-stage { padding-left: 0.5rem; margin-top: 1rem; }
}
@media (max-width: 520px) {
  .phone { width: 30%; left: -2%; bottom: -2rem; border-radius: 22px; padding: 4px; }
  .phone img { border-radius: 18px; }
  .annot-hero { font-size: 1.2rem; top: -1.6rem; }
}

/* ---------- RULER ---------- */
.ruler-wrap { overflow: hidden; margin: 1rem 0 0; }
.ruler {
  position: relative;
  background: var(--wood);
  color: #10284f;
  height: 74px;
  border-top: 1px solid rgba(16,40,79,.25);
  border-bottom: 1px solid rgba(16,40,79,.25);
  transform: rotate(-1deg);
  margin: 0 -2rem;
  box-shadow: 0 10px 22px -16px rgba(16,40,79,.5);
  background-image:
    linear-gradient(90deg, rgba(16,40,79,.75) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16,40,79,.55) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16,40,79,.4) 1px, transparent 1px);
  background-size: 60px 22px, 30px 15px, 6px 9px;
  background-repeat: repeat-x;
  background-position: 0 0;
}
@media (prefers-color-scheme: dark) { .ruler { filter: brightness(.9); } }
.ruler-nums { position: absolute; inset: 22px 0 auto 0; height: 14px; }
.ruler-nums span { position: absolute; top: 0; font: 500 10px/1 var(--mono); transform: translateX(-50%); opacity: .7; }
.ruler-words {
  position: absolute; left: 0; right: 0; bottom: 10px;
  display: flex; gap: 2.6rem;
  list-style: none; margin: 0; padding: 0 3rem;
  white-space: nowrap;
  font-size: 0.82rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  animation: slide 50s linear infinite;
}
.ruler-words li::before { content: "◦ "; opacity: .5; }
@keyframes slide { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ruler-words { animation: none; } }

/* ---------- FIG sections ---------- */
.fig {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.35fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  padding-top: clamp(5rem, 10vw, 8rem);
}
.fig-flip { grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.8fr); }
.fig-flip .fig-copy { order: 2; }
.fig-copy > p { color: var(--ink-soft); font-size: 1.06rem; }
.fig-media { margin: 0; }
.fig-media figcaption { margin-top: 1.4rem; color: var(--ink-soft); padding-left: 0.5rem; border-left: 2px solid var(--coral); }

.specs { margin: 1.75rem 0 0; border-top: 1px solid var(--rule); }
.specs div { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; padding: 0.8rem 0; border-bottom: 1px solid var(--rule); }
.specs dt { font: 500 0.78rem/1.9 var(--mono); color: var(--pencil); text-transform: uppercase; letter-spacing: .05em; }
.specs dd { margin: 0; font-size: 0.98rem; }

.code {
  margin: 1.5rem 0 1rem;
  padding: 1.1rem 1.2rem;
  background: var(--navy-deep);
  color: #f4ede1;
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.8;
  overflow-x: auto;
}
.code .c { color: #8fa3c7; }
.code .r { color: var(--coral); }

@media (max-width: 900px) {
  .fig, .fig-flip { grid-template-columns: 1fr; }
  .fig-flip .fig-copy { order: 0; }
}
@media (max-width: 640px) {
  .annot { font-size: 1.15rem; }
  .annot .arrow-left { width: 40px; }
  .tape { width: 80px; height: 24px; }
}

/* ---------- TRY IT ---------- */
.try { padding-top: clamp(4rem, 8vw, 6rem); }
.try-card {
  background: var(--navy-deep);
  color: #f4ede1;
  border-radius: 10px;
  padding: clamp(1.5rem, 4vw, 3rem);
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  background-image:
    linear-gradient(rgba(250,244,234,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(250,244,234,.05) 1px, transparent 1px);
  background-size: 24px 24px;
  box-shadow: var(--shadow);
}
.try-card h2 { color: #f4ede1; }
.try-card .fig-no { color: var(--coral); }
.try-head p:not(.fig-no) { color: rgba(244,237,225,.75); }
.beam { width: 100%; height: auto; display: block; }
.beam .wall { fill: url(#hatch); stroke: none; }
.beam pattern line { stroke: rgba(244,237,225,.45); stroke-width: 2; }
.beam .wall-edge { stroke: #f4ede1; stroke-width: 3; }
.beam .beam-ghost { stroke: rgba(244,237,225,.2); stroke-width: 2; stroke-dasharray: 6 6; fill: none; }
.beam .beam-line { stroke: #f4ede1; stroke-width: 9; fill: none; stroke-linecap: butt; }
.beam .load { stroke: var(--coral); stroke-width: 3; }
.beam .load-head { stroke: var(--coral); stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.beam .lbl { fill: rgba(244,237,225,.85); font: 500 13px var(--mono); }
.beam .dim line, .beam .dim path { stroke: rgba(244,237,225,.5); stroke-width: 1.2; fill: none; }
.beam .delta { stroke: var(--coral); stroke-width: 2; stroke-dasharray: 3 3; }

.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 2rem; margin: 1.25rem 0 1.5rem; }
.controls label { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0.2rem 0.75rem; }
.controls label > span { grid-column: 1; color: rgba(244,237,225,.7); }
.controls output { grid-column: 2; justify-self: end; color: #f4ede1; }
.controls input { grid-column: 1 / -1; width: 100%; accent-color: var(--coral); }
input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; height: 26px; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; background: rgba(244,237,225,.2); border-radius: 2px; }
input[type=range]::-moz-range-track { height: 4px; background: rgba(244,237,225,.2); border-radius: 2px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: var(--coral); border: 3px solid var(--navy-deep); box-shadow: 0 0 0 1px var(--coral); cursor: grab; }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--coral); border: 3px solid var(--navy-deep); cursor: grab; }

.result { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1.5rem; border-top: 1px solid rgba(244,237,225,.15); padding-top: 1.1rem; }
.result p { margin: 0; }
.formula { color: rgba(244,237,225,.7); flex-basis: 100%; }
.answer { font: 400 clamp(2.4rem, 5vw, 3.4rem)/1 var(--serif); }
.answer .hand { font-size: 0.8em; color: var(--coral); }
.answer strong { font-weight: 500; font-variant-numeric: tabular-nums; }
.answer .unit { font-size: 0.55em; color: rgba(244,237,225,.7); }
.result .small { color: rgba(244,237,225,.55); }

@media (max-width: 900px) { .try-card { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .controls { grid-template-columns: 1fr; } }

/* ---------- CONTENTS ---------- */
.contents { padding-top: clamp(5rem, 10vw, 8rem); display: grid; grid-template-columns: minmax(0, 0.6fr) minmax(0, 1.4fr); gap: 2rem 4rem; }
.toc-head .hand { font-size: 1.6rem; color: var(--pencil); margin: -0.25rem 0 0; transform: rotate(-2deg); transform-origin: left; }
.toc { list-style: none; margin: 0; padding: 0; columns: 2 20rem; column-gap: 3.5rem; }
.toc li { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 0 0.5rem; break-inside: avoid; padding: 0 0 1.3rem; }
.toc .t { font: 500 1.2rem/1.3 var(--serif); }
.toc .lead { border-bottom: 2px dotted color-mix(in srgb, var(--ink-soft) 55%, transparent); transform: translateY(-0.3em); }
.toc .n { color: var(--pencil); }
.toc p { grid-column: 1 / -1; margin: 0.2rem 0 0; color: var(--ink-soft); font-size: 0.94rem; }
@media (max-width: 800px) { .contents { grid-template-columns: 1fr; } }

/* ---------- PRIVACY ---------- */
.privacy { padding-top: clamp(5rem, 10vw, 8rem); display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(2.5rem, 6vw, 5rem); align-items: center; }
.postit {
  position: relative;
  justify-self: center;
  width: min(100%, 22rem);
  aspect-ratio: 1;
  background: #ffd9c9;
  color: #10284f;
  padding: 2.4rem 2rem;
  transform: rotate(-3deg);
  box-shadow: 0 2px 2px rgba(16,40,79,.08), 0 26px 30px -20px rgba(16,40,79,.4);
  background-image: linear-gradient(180deg, rgba(255,255,255,.35), transparent 30%);
  display: flex; align-items: center;
}
.postit p { margin: 0; font-size: clamp(1.9rem, 3.5vw, 2.4rem); line-height: 1.05; }
.postit .big { display: inline-block; margin-top: 0.6rem; font-weight: 700; font-size: 1.15em; border-bottom: 3px solid #c4553a; }
.privacy-copy > p { color: var(--ink-soft); font-size: 1.06rem; }
@media (max-width: 800px) { .privacy { grid-template-columns: 1fr; } }

/* ---------- FINAL ---------- */
.final { margin-top: clamp(5rem, 10vw, 8rem); background: var(--navy); color: var(--cream); overflow: hidden; }
.final + * { margin-top: 0; }
.final-inner { display: grid; grid-template-columns: auto 1fr; gap: clamp(2rem, 6vw, 5rem); align-items: center; padding-top: 4rem; padding-bottom: 4rem; }
.final h2 { color: var(--cream); font-size: clamp(2.2rem, 5vw, 3.6rem); }
.final p { color: rgba(250,244,234,.75); font-size: 1.1rem; margin: 0 0 1.75rem; }
.mascot { width: clamp(120px, 17vw, 200px); height: auto; margin: -2rem 0 -4rem; filter: drop-shadow(0 18px 20px rgba(0,0,0,.3)); }
.mascot .sticker { fill: var(--cream); stroke: var(--cream); stroke-width: 20; stroke-linejoin: round; }
.mascot .eraser { fill: var(--coral); stroke: #0e2a57; stroke-width: 5; }
.mascot .band, .mascot .body { fill: var(--cream); stroke: #0e2a57; stroke-width: 5; stroke-linejoin: round; }
.mascot .wood { fill: var(--wood); stroke: #0e2a57; stroke-width: 5; stroke-linejoin: round; }
.mascot .lead { fill: #0e2a57; }
.mascot .eye { fill: #0e2a57; }
.mascot .glint { fill: #fff; }
.mascot .smile { fill: none; stroke: #0e2a57; stroke-width: 4; stroke-linecap: round; }
.mascot .cheek { fill: var(--coral); opacity: .85; }
.mascot g { transform-box: fill-box; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .mascot { transition: transform .5s cubic-bezier(.3,1.6,.5,1); }
  .final:hover .mascot { transform: rotate(-8deg) translateY(-6px); }
}
@media (max-width: 600px) {
  .final-inner { grid-template-columns: 1fr; }
  .mascot { margin: 0; }
}
.final + .site-foot, main:has(.final:last-child) + .site-foot { margin-top: 0; }

.nowrap { white-space: nowrap; }
.annot-hero { right: 4%; }

/* Fig 02 — phone on the page */
.fig-phone { display: flex; flex-direction: column; align-items: center; }
.fig-phone figcaption { align-self: stretch; }
.phone-big {
  position: relative;
  width: min(21rem, 72%);
  background: #0a0f1a;
  padding: 9px;
  border-radius: 46px;
  transform: rotate(-2deg);
  box-shadow: 0 40px 60px -30px rgba(16,40,79,.55);
}
.phone-big img { border-radius: 38px; }
.annot-side { flex-direction: column; align-items: flex-start; white-space: nowrap; transform: rotate(-4deg); }
.annot-side svg { width: 58px; height: 36px; order: 2; margin: 0.1rem 0 0 -0.9rem; }
.ring { width: 30%; }
@media (max-width: 640px) {
  .phone-big { width: 70%; border-radius: 34px; padding: 6px; }
  .phone-big img { border-radius: 29px; }
  .annot-side { font-size: 1.05rem; }
}

html, body { overflow-x: clip; }
@media (max-width: 640px) {
  .annot-side { left: 50%; top: calc(100% + 0.6rem); transform: translateX(-50%) rotate(-2deg); flex-direction: row; font-size: 1.3rem; }
  .annot-side br { display: none; }
  .annot-side svg { display: none; }
  .fig-phone figcaption { margin-top: 3.2rem; }
  .beam .lbl { font-size: 22px; }
}
