/* nthbefore.com — Newer Than Before Inc.
   The brand is a comparison: Newer > Before.
   "Newer" speaks in Schibsted Grotesk on white. "Before" speaks in Times on grey.
   The red seam between them is the > of the logo.
   Product colours come from themes.css (written by build.py from catalog.json). */

@font-face {
  font-family: "Schibsted Grotesk";
  src: url("/assets/fonts/schibsted.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}

:root {
  --paper: #FFFFFF;
  --ink: #111111;
  --seam: #E8391D;
  --old-bg: #DDDCD7;
  --old-ink: #2A2A2A;
  --gutter: clamp(18px, 4.6vw, 72px);
  --max: 1680px;
  --d: clamp(22px, 3.4vw, 56px);          /* depth of the > point */
  --new: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --old: "Times New Roman", Times, "Liberation Serif", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--new); font-size: 18px; line-height: 1.5; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; padding: 0; }
ol, ul { list-style: none; }
.wrap { max-width: var(--max); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.skip { position: absolute; left: -9999px; top: 0; background: var(--ink); color: #fff; padding: 12px 16px; z-index: 20; }
.skip:focus { left: 0; }
:focus-visible { outline: 3px solid var(--seam); outline-offset: 3px; }

/* =====================================================================
   HERO: two copies of the same page. .new is the real one. .old is the
   "before" version, clipped to one side of the seam.
   --sx: seam position from the left (wide screens)
   --sy: seam position from the top (narrow screens)
   ===================================================================== */
.hero { position: relative; overflow: hidden; --sx: 48%; --sy: 300px; --sy2: 380px; --hd: clamp(40px, 6.4vw, 124px); background: var(--paper); }
.layer.new { position: relative; z-index: 1; min-height: max(100svh, 700px); display: flex; flex-direction: column; padding-bottom: clamp(28px, 4vw, 56px); }
.layer.new > .wrap:not(.bar) { width: 100%; flex: 1; display: flex; flex-direction: column; }
.layer.old {
  position: absolute; inset: 0; z-index: 2; overflow: hidden;
  background: var(--old-bg); color: var(--old-ink); font-family: var(--old);
  clip-path: polygon(var(--sx) 0, 100% 0, 100% 100%, var(--sx) 100%, calc(var(--sx) + var(--hd)) 50%);
  display: flex; flex-direction: column; padding-bottom: clamp(28px, 4vw, 56px);
}
.layer.old > .wrap:not(.bar) { width: 100%; flex: 1; display: flex; flex-direction: column; }

.seam { position: absolute; z-index: 3; pointer-events: none; overflow: visible; }
.seam polyline { fill: none; stroke: var(--seam); stroke-width: 4; vector-effect: non-scaling-stroke; stroke-linejoin: miter; }
.seam-h { left: var(--sx); top: 0; width: var(--hd); height: 100%; }
.seam-v, .seam-v2 { display: none; }

.handle {
  position: absolute; z-index: 4; left: calc(var(--sx) + var(--hd)); top: 50%;
  width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%;
  border: 0; background: var(--seam); color: #fff; cursor: ew-resize; touch-action: none;
  display: grid; place-items: center; padding: 0;
  box-shadow: 0 6px 18px rgba(0,0,0,.22);
}
.handle svg { width: 26px; height: 26px; }
.handle.done, .hero.done .seam { opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  .handle { transition: opacity .3s; animation: nudge 2.4s ease-in-out 1.2s 2; }
  @keyframes nudge { 0%, 100% { transform: none; } 30% { transform: translateX(-10px); } 60% { transform: translateX(10px); } }
}

/* ---------- bar ---------- */
.bar { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 22px; padding-bottom: 22px; min-height: 92px; }
.logo { display: block; padding: 8px 0; }
.logo img { height: 34px; width: auto; }
.bar nav { display: flex; gap: clamp(16px, 2.6vw, 40px); }
.bar nav a { text-decoration: none; font-weight: 600; font-size: 17px; padding: 12px 0; border-bottom: 2px solid transparent; white-space: nowrap; }
.bar nav a:hover { border-bottom-color: var(--seam); }
.oldlogo { font-weight: 700; font-size: 22px; }
.oldnav { font-size: 17px; white-space: nowrap; }
.old a { color: #0000EE; text-decoration: underline; }

/* ---------- the staircase headline: same boxes in both layers ---------- */
.stair { display: grid; margin-top: clamp(8px, 2vw, 36px); font-size: clamp(64px, min(11.4vw, 19.5vh), 212px); line-height: .88; }
.stair span { display: block; white-space: nowrap; }
.new .stair { font-weight: 800; letter-spacing: -.055em; }
.old .stair { font-weight: 400; font-style: italic; letter-spacing: -.02em; }
.w1 { justify-self: start; }
.w2 { justify-self: start; margin-left: .62em; }
.w3 { justify-self: end; }

/* ---------- under the headline ---------- */
.below { flex: 1; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); column-gap: clamp(24px, 5vw, 96px); align-items: end; margin-top: clamp(20px, 2.6vw, 44px); }
.lede { max-width: 25em; font-size: clamp(19px, 1.55vw, 26px); line-height: 1.38; font-weight: 500; }
.old .lede { font-weight: 400; font-size: clamp(18px, 1.4vw, 22px); }
.cta { margin-top: 26px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 26px; }
.btn { display: inline-flex; align-items: center; gap: .45em; min-height: 56px; padding: 0 28px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 700; font-size: 18px; text-decoration: none; }
.btn:hover { background: var(--seam); }
.plain { font-weight: 600; font-size: 17px; padding: 14px 0; text-underline-offset: .2em; }
.old .btn { min-height: 0; padding: 4px 14px; border-radius: 0; background: #D4D0C8; color: #000 !important; border: 2px outset #fff; font: 16px var(--old); text-decoration: none !important; }

.chips { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 6px 20px; }
.new .chips a { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; text-decoration: none; font-weight: 700; font-size: 16px; }
.new .chips img, .nothumb { width: 40px; height: 27px; object-fit: cover; border-radius: 4px; box-shadow: 0 0 0 1px rgba(17,17,17,.14); }
.nothumb { background: #EEE; }
.new .chips a:hover span { text-decoration: underline; text-decoration-color: var(--seam); text-underline-offset: .2em; text-decoration-thickness: 2px; }
.old .chips { display: block; list-style: disc; padding-left: 22px; margin-top: 18px; }
.old .chips li { font-size: 17px; line-height: 1.5; }
.oldnote { margin-top: 18px; font-size: 14px; font-style: italic; }

/* ---------- collage of real screens (new) / broken images (old) ---------- */
.collage { position: relative; align-self: stretch; min-height: clamp(220px, 24vw, 420px); }
.shot { position: absolute; object-fit: cover; object-position: top center; border-radius: 12px; box-shadow: 0 18px 40px -14px rgba(0,0,0,.38), 0 0 0 1px rgba(17,17,17,.1); background: #eee; }
.c-wide { aspect-ratio: 16 / 10; }
.c-tall { aspect-ratio: 9 / 16; border-radius: 18px; }
.c-wide0 { left: 16%; top: 0; width: 56%; transform: rotate(-2deg); z-index: 1; }
.c-tall0 { left: 0; top: 14%; width: 21%; transform: rotate(-5deg); z-index: 3; }
.c-wide1 { left: 42%; top: 44%; width: 50%; transform: rotate(3deg); z-index: 2; }
.c-tall1 { right: 0; top: 2%; width: 20%; transform: rotate(5deg); z-index: 4; }
.old .shot { border-radius: 0; box-shadow: none; background: #F3F2EE; border: 2px inset #999; color: #333; font-size: 13px; line-height: 1.2; padding: 26px 6px 6px 8px; overflow: hidden; overflow-wrap: anywhere; }
.broken { position: absolute; left: 6px; top: 6px; width: 14px; height: 16px; border: 1px solid #777; background: linear-gradient(135deg, #fff 50%, #c33 50%); }

/* =====================================================================
   WORK: every entry is a pair. Newer on the left in the product's own
   colours, its "before" on the right in grey. The newer side points
   into the before side with the same > as the logo.
   ===================================================================== */
.work { background: var(--paper); }
.intro { padding-top: clamp(64px, 9vw, 150px); padding-bottom: clamp(36px, 5vw, 80px); display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: clamp(24px, 5vw, 96px); align-items: end; }
.intro h2, .tests h2, .brief h2 { font-weight: 800; font-size: clamp(34px, 5.2vw, 92px); line-height: .96; letter-spacing: -.045em; text-wrap: balance; }
.intro p { font-size: clamp(18px, 1.4vw, 22px); max-width: 26em; padding-bottom: .4em; }

.pair {
  --bg: #F3F2EE; --fg: var(--ink); --accent: var(--ink); --rule: rgba(17,17,17,.22);
  --btn-bg: var(--ink); --btn-fg: #fff; --btn-radius: 999px; --panel-bg: #fff; --shot-border: 0; --bw: 30%;
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) var(--bw);
  background: var(--old-bg); overflow: hidden;
  border-top: 1px solid rgba(17,17,17,.12);
}
.js .pair { --bw: 46%; }
.js .pair.in { --bw: 30%; }
@media (prefers-reduced-motion: no-preference) { .js .pair { transition: grid-template-columns 1s cubic-bezier(.2,.7,.1,1); } }

.now { position: relative; z-index: 1; background: var(--bg); color: var(--fg); margin-right: calc(-1 * var(--d)); clip-path: polygon(0 0, calc(100% - var(--d)) 0, 100% 50%, calc(100% - var(--d)) 100%, 0 100%); display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 4fr); column-gap: clamp(24px, 4vw, 72px); align-items: center; padding: clamp(48px, 7vw, 120px) calc(var(--d) + clamp(24px, 4vw, 72px)) clamp(48px, 7vw, 120px) var(--gutter); min-width: 0; }
.words { min-width: 0; }
.kind { font-weight: 700; font-size: 16px; margin-bottom: 10px; color: var(--accent); }
.pair h3 { font-weight: 800; font-size: clamp(40px, 5.4vw, 96px); line-height: .92; letter-spacing: -.05em; overflow-wrap: anywhere; }
.pair h3.long { font-size: clamp(34px, 4.2vw, 72px); }
.pair h3.xlong { font-size: clamp(26px, 2.9vw, 50px); letter-spacing: -.04em; }
.newer { margin-top: 18px; font-size: clamp(21px, 1.9vw, 30px); font-weight: 700; line-height: 1.18; letter-spacing: -.015em; color: var(--accent); max-width: 20em; text-wrap: balance; }
.body { margin-top: 20px; max-width: 31em; font-size: clamp(17px, 1.2vw, 19px); }
.facts { margin-top: 22px; max-width: 31em; border-top: 2px solid var(--rule); }
.facts li { padding: 11px 0; border-bottom: 2px solid var(--rule); font-weight: 600; font-size: 16px; line-height: 1.4; }
.go { display: inline-flex; align-items: center; gap: .5em; margin-top: 28px; min-height: 54px; padding: 0 26px; font-weight: 700; font-size: 18px; text-decoration: none; background: var(--btn-bg); color: var(--btn-fg); border-radius: var(--btn-radius); }
.go span { font-size: 1.3em; line-height: 1; padding-bottom: .12em; }
.go:hover span { transform: translateX(4px); }
.fig img { width: 100%; }
.l-phone .fig img { max-width: 300px; margin: 0 auto; border-radius: 30px; border: var(--shot-border); box-shadow: 0 30px 60px -24px rgba(0,0,0,.45); }
.l-browser .now { grid-template-columns: minmax(0, 1fr); row-gap: clamp(28px, 3.4vw, 52px); }
.l-browser .fig img { border: 2px solid var(--fg); border-radius: 10px; }
.l-text .now { grid-template-columns: minmax(0, 1fr); }
.l-scene .now { grid-template-columns: minmax(0, 1fr); min-height: clamp(520px, 52vw, 780px); }
.l-scene .scene { position: absolute; inset: 0; }
.l-scene .scene img { width: 100%; height: 100%; object-fit: cover; object-position: 0% 30%; }
.l-scene .words { position: relative; justify-self: end; background: var(--panel-bg); border: 3px solid var(--fg); padding: clamp(22px, 2.8vw, 44px); max-width: 520px; }

.was {
  background: var(--old-bg); color: var(--old-ink); font-family: var(--old);
  display: flex; flex-direction: column; justify-content: center; min-width: 0;
  padding: clamp(32px, 4vw, 64px) clamp(20px, 3vw, 48px) clamp(32px, 4vw, 64px) calc(var(--d) + clamp(20px, 2.6vw, 44px));
}
.notch { position: absolute; z-index: 2; left: calc(100% - var(--bw)); top: 0; width: var(--d); height: 100%; overflow: visible; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) { .js .notch { transition: left 1s cubic-bezier(.2,.7,.1,1); } }
.notch polyline { fill: none; stroke: var(--seam); stroke-width: 4; vector-effect: non-scaling-stroke; }
.notch .nv { display: none; }
.was-label { font-style: italic; font-size: 18px; }
.was-text { margin-top: 10px; font-style: italic; font-size: clamp(22px, 2.1vw, 34px); line-height: 1.22; text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: var(--seam); }
.js .was-text { text-decoration-color: transparent; }
.js .in .was-text { text-decoration-color: var(--seam); transition: text-decoration-color .5s .7s; }

/* =====================================================================
   TESTS, BRIEF, FOOTER
   ===================================================================== */
.tests { padding: clamp(72px, 10vw, 160px) 0; border-top: 1px solid rgba(17,17,17,.12); }
.rules { margin-top: clamp(36px, 5vw, 72px); counter-reset: r; border-top: 3px solid var(--ink); }
.rules li { counter-increment: r; display: grid; grid-template-columns: clamp(44px, 6vw, 96px) minmax(0, 5fr) minmax(0, 6fr); column-gap: clamp(16px, 3vw, 48px); padding: clamp(22px, 2.6vw, 38px) 0; border-bottom: 3px solid var(--ink); align-items: baseline; }
.rules li::before { content: counter(r); font-family: var(--old); font-style: italic; font-size: clamp(34px, 3.6vw, 60px); line-height: .9; color: var(--seam); }
.rules h3 { font-weight: 800; font-size: clamp(22px, 2.3vw, 36px); line-height: 1.06; letter-spacing: -.03em; }
.rules p { max-width: 33em; font-size: clamp(17px, 1.3vw, 20px); }

.brief { background: #F3F2EE; padding: clamp(72px, 10vw, 160px) 0; }
.brief-head { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: clamp(24px, 5vw, 96px); align-items: end; }
.brief-head p { font-family: var(--old); font-style: italic; font-size: clamp(20px, 1.8vw, 28px); line-height: 1.25; padding-bottom: .35em; }
.sheet { margin-top: clamp(36px, 5vw, 72px); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 3px solid var(--ink); }
.sheet > div { padding: 24px clamp(14px, 2vw, 32px) 28px 0; border-bottom: 1px solid rgba(17,17,17,.3); }
.sheet dt { font-family: var(--old); font-style: italic; font-size: 17px; color: #444; }
.sheet dd { margin-top: 6px; font-size: clamp(18px, 1.45vw, 22px); font-weight: 700; line-height: 1.3; letter-spacing: -.01em; }
.sheet a { display: inline-block; padding: 9px 0; margin: -9px 0; text-decoration-color: var(--seam); text-decoration-thickness: 2px; text-underline-offset: .2em; overflow-wrap: anywhere; }
.proof { margin-top: clamp(32px, 4vw, 56px); font-weight: 800; font-size: clamp(22px, 2.6vw, 42px); line-height: 1.1; letter-spacing: -.03em; max-width: 24em; text-wrap: balance; }

.foot { background: var(--ink); color: #fff; padding: clamp(56px, 7vw, 110px) 0 34px; }
.foot-ask { font-weight: 700; font-size: clamp(24px, 3vw, 46px); line-height: 1.1; letter-spacing: -.03em; max-width: 20em; }
.foot-ask a { display: inline-block; padding: 8px 0; color: #FF6A4D; text-underline-offset: .14em; text-decoration-thickness: .07em; }
.foot-logo { width: 100%; height: auto; margin-top: clamp(44px, 6vw, 100px); }
.foot-row { margin-top: 34px; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; font-size: 16px; color: #BDBDBD; }
.foot-row ul { display: flex; gap: 6px 28px; flex-wrap: wrap; }
.foot-row a { display: inline-block; padding: 12px 0; color: #fff; text-underline-offset: .2em; }

.lost { min-height: 100svh; background: var(--old-bg); color: var(--old-ink); font-family: var(--old); padding: 40px var(--gutter); }
.lost h1 { font-size: clamp(40px, 8vw, 96px); font-style: italic; font-weight: 400; line-height: 1; margin: 12vh 0 24px; }
.lost a { color: #0000EE; }

/* =====================================================================
   NARROW SCREENS: the seam turns. Newer on top, before underneath,
   and the > points down.
   ===================================================================== */
@media (max-width: 860px) {
  body { font-size: 17px; }
  :root { --d: clamp(14px, 4.6vw, 30px); }
  .layer.old { clip-path: polygon(0 var(--sy), 50% calc(var(--sy) + var(--d)), 100% var(--sy), 100% var(--sy2), 50% calc(var(--sy2) + var(--d)), 0 var(--sy2)); }
  .seam-h, .handle { display: none; }
  html:not(.js) .layer.old, html:not(.js) .seam { display: none; }
  .seam-v { display: block; left: 0; top: var(--sy); width: 100%; height: var(--d); }
  .seam-v2 { display: block; left: 0; top: var(--sy2); width: 100%; height: var(--d); }

  .layer.new { min-height: max(100svh, 640px); }
  .bar { min-height: 72px; padding-top: 12px; padding-bottom: 12px; }
  .logo img { height: 26px; }
  .bar nav { gap: 16px; }
  .bar nav a { font-size: 16px; }
  .oldlogo { font-size: 18px; }
  .oldnav { font-size: 15px; }
  .stair { font-size: clamp(58px, 21vw, 150px); line-height: .9; margin-top: 4px; }
  .w2 { margin-left: .5em; }
  .w3 { margin-top: .36em; }
  .below { grid-template-columns: minmax(0, 1fr); row-gap: 30px; align-items: start; margin-top: calc(var(--d) + 26px); }
  .collage { min-height: 0; aspect-ratio: 16 / 10; }

  .intro, .brief-head { grid-template-columns: minmax(0, 1fr); row-gap: 16px; }
  .pair, .js .pair, .js .pair.in { grid-template-columns: minmax(0, 1fr); }
  .now { grid-template-columns: minmax(0, 1fr); row-gap: 34px; padding: 52px var(--gutter) calc(var(--d) + 48px); margin: 0 0 calc(-1 * var(--d)); clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--d)), 50% 100%, 0 calc(100% - var(--d))); }
  .l-phone .fig img { max-width: 260px; }
  .l-scene .now { min-height: 0; padding: 0; row-gap: 0; background: var(--panel-bg); }
  .l-scene .scene { position: static; height: 260px; }
  .l-scene .scene img { object-position: 30% 35%; }
  .l-scene .words { justify-self: stretch; max-width: none; border-width: 3px 0 0; padding: 36px var(--gutter) calc(var(--d) + 44px); }
  .was { position: relative; padding: calc(var(--d) + 26px) var(--gutter) 34px; }
  .notch, .js .notch { position: relative; left: 0; top: auto; width: 100%; height: var(--d); margin-bottom: calc(-1 * var(--d)); transition: none; }
  .notch .nh { display: none; }
  .notch .nv { display: block; }
  .rules li { grid-template-columns: 40px minmax(0, 1fr); row-gap: 8px; }
  .rules p { grid-column: 2; }
  .sheet { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .bar nav a:first-child { display: none; }
  .oldnav a:first-child { display: none; }
  .sheet { grid-template-columns: minmax(0, 1fr); }
  .cta .plain { display: none; }
}
@media (min-width: 1800px) { body { font-size: 20px; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
