/*
  Watch Reader on the web: the app's components for marketing pages, templates and the site.
  Tokens come from ../tokens/tokens.css (generated from design/tokens/tokens.json); this file only uses them.
  Link both, then watchreader.js for covers, meshes and grain.
*/
@import url("../tokens/tokens.css");

@font-face { font-family: "Instrument Serif"; src: url("fonts/InstrumentSerif-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("fonts/InstrumentSerif-Italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("fonts/InstrumentSans-Variable.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Literata"; src: url("fonts/Literata-Variable.woff2") format("woff2"); font-weight: 200 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Literata"; src: url("fonts/Literata-Italic-Variable.woff2") format("woff2"); font-weight: 200 900; font-style: italic; font-display: swap; }

/* ---------- Base ---------- */
.wr {
  background: var(--wr-ink);
  color: #fff;
  font-family: var(--wr-font-ui);
  -webkit-font-smoothing: antialiased;
}
.wr *, .wr *::before, .wr *::after { box-sizing: border-box; }

/* Type: the three faces. Display has one weight; size carries the hierarchy. */
.wr-display { font-family: var(--wr-font-display); font-weight: 400; letter-spacing: -0.01em; line-height: 0.95; }
.wr-display em, .wr-display i { font-style: italic; }
.wr-reading { font-family: var(--wr-font-reading); font-weight: 400; line-height: 1.5; }
.wr-ui { font-family: var(--wr-font-ui); }
.wr-wordmark { font-family: var(--wr-font-display); font-weight: 400; letter-spacing: -0.015em; line-height: 1; color: var(--wr-accent); white-space: nowrap; }
.wr-secondary { color: var(--wr-text-secondary); }
.wr-bone { color: var(--wr-accent); }

/* Lockup: icon + wordmark (icon at 1.15x the cap size) */
.lockup { display: inline-flex; align-items: center; gap: 0.32em; }
.lockup img { width: 1.15em; height: 1.15em; border-radius: 22.5%; box-shadow: 0 0.06em 0.2em rgb(0 0 0 / 0.35); }
.lockup .wr-wordmark { font-size: 1em; }


/* ---------- Surfaces ---------- */
/* The ink page: a soft glow at the upper middle (inkPaper's 0.5, 0.22) and film grain */
.wr-page {
  position: relative;
  background:
    radial-gradient(ellipse 70% 45% at 50% 22%, rgb(255 255 255 / 0.06), transparent 70%),
    var(--wr-page-bg, var(--wr-ink));
  overflow: hidden;
}
.wr-grain { position: relative; isolation: isolate; }
.wr-grain::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 5;
  background-image: var(--wr-grain-tile);
  background-size: 256px 256px;
  mix-blend-mode: overlay;
  opacity: calc(var(--grain, var(--wr-grain-cover)) * 2.5);
  border-radius: inherit;
}
.wr-card { background: var(--wr-card); border-radius: var(--wr-radius-card); }
.wr-hairline { border: 0.5px solid var(--wr-hairline); }

/* Liquid Glass, as near as CSS gets: frosted, a bright top edge, a soft shadow */
.wr-glass {
  background: rgb(255 255 255 / 0.10);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  backdrop-filter: blur(18px) saturate(1.6);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.28), inset 0 -1px 0 rgb(255 255 255 / 0.06), 0 6px 20px rgb(0 0 0 / 0.25);
  color: #fff;
}
.wr-chip {
  display: inline-flex; align-items: center; gap: 0.45em;
  padding: 0.55em 1.05em; border-radius: 999px;
  font: 500 15px/1 var(--wr-font-ui);
}
.wr-chip.is-on { background: rgb(255 255 255 / 0.92); color: var(--wr-ink); box-shadow: inset 0 1px 0 #fff, 0 6px 20px rgb(0 0 0 / 0.25); }
.wr-round { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background-color: var(--wr-glass-tint); }

/* ---------- Covers ---------- */
/* A seeded mesh (watchreader.js paints it) or real artwork, with the 0.5pt edge */
.wr-cover {
  position: relative; overflow: hidden; display: block;
  border-radius: var(--r, var(--wr-radius-row-cover));
  aspect-ratio: var(--aspect, 1);
  background: var(--wr-card);
}
.wr-cover > canvas, .wr-cover > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.wr-cover::before { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 0.5px rgb(255 255 255 / 0.08); z-index: 6; pointer-events: none; }
.wr-cover .wr-letter {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 4;
  font: 600 calc(var(--size, 100px) * 0.58)/1 -apple-system, "SF Pro Display", system-ui, sans-serif;
  color: #fff; mix-blend-mode: overlay; opacity: 0.78; pointer-events: none;
}
.wr-cover .wr-letter span { grid-area: 1 / 1; }
.wr-cover .wr-letter .soft { filter: blur(calc(var(--size, 100px) * 0.077)); opacity: 0.8; }
.wr-cover .wr-letter .sharp { filter: blur(calc(var(--size, 100px) * 0.017)); -webkit-mask-image: radial-gradient(circle at var(--mx, 35%) var(--my, 30%), #000 10%, transparent 62%); mask-image: radial-gradient(circle at var(--mx, 35%) var(--my, 30%), #000 10%, transparent 62%); }

/* ---------- Controls ---------- */
/* PlayDisc: the item's colours as a mesh, lit from above, breathing while it reads */
.wr-disc { position: relative; width: var(--size, 72px); height: var(--size, 72px); }
.wr-disc .face, .wr-disc .glow { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; }
.wr-disc .glow { filter: blur(calc(var(--size, 72px) * 0.28)); opacity: 0.45; transform: scale(1.08); }
.wr-disc.is-playing .glow { animation: wr-breathe var(--wr-breathe) var(--wr-ease-in-out) infinite alternate; }
.wr-disc .face::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: linear-gradient(rgb(255 255 255 / 0.18), rgb(0 0 0 / 0.22), rgb(0 0 0 / 0.42)); box-shadow: inset 0 0 0 0.75px rgb(255 255 255 / 0.22); }
.wr-disc .face { box-shadow: 0 calc(var(--size, 72px) * 0.06) calc(var(--size, 72px) * 0.12) rgb(0 0 0 / 0.45); }
.wr-disc .icon { position: absolute; inset: 0; display: grid; place-items: center; z-index: 2; }
.wr-disc .icon svg { width: 36%; height: 36%; fill: #fff; filter: drop-shadow(0 1px 3px rgb(0 0 0 / 0.3)); }
@keyframes wr-breathe { from { opacity: 0.45; transform: scale(1.08); } to { opacity: 0.85; transform: scale(1.22); } }
@media (prefers-reduced-motion: reduce) { .wr-disc.is-playing .glow { animation: none; opacity: 0.6; } }

.wr-progress { height: 3px; border-radius: 3px; background: rgb(255 255 255 / 0.25); position: relative; overflow: hidden; }
.wr-progress > i { position: absolute; inset: 0 auto 0 0; width: calc(var(--p, 0.4) * 100%); background: rgb(255 255 255 / 0.9); border-radius: inherit; }
.wr-tick { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--wr-done); }
.wr-tick svg { width: 60%; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Read-along ---------- */
/* Read text and the spoken sentence bright; the rest at the unread opacity */
.wr-readalong { font-family: var(--wr-font-reading); line-height: 1.5; color: #fff; }
.wr-readalong .unread { opacity: var(--wr-unread); }
.wr-readalong .now { opacity: 1; }
.wr-readalong .edge { background: linear-gradient(90deg, #fff 0%, rgb(255 255 255 / var(--wr-unread)) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Doodles ---------- */
/* The app's hand-drawn marker doodles (design/brand/doodles), tinted with currentColor */
.wr-doodle {
  display: inline-block; width: var(--w, 88px); aspect-ratio: var(--ar, 4 / 3);
  background-color: currentColor;
  -webkit-mask: var(--src) center / contain no-repeat;
  mask: var(--src) center / contain no-repeat;
}

/* ---------- Devices ---------- */
/* iPhone (6.9", 440×956pt screen), drawn in CSS. A screenshot or a built screen goes inside .screen */
.wr-phone {
  --pt: calc(var(--phone-w, 440px) / 440);
  position: relative; width: calc(var(--phone-w, 440px) + 24 * var(--pt)); aspect-ratio: 464 / 980;
  border-radius: calc(78 * var(--pt)); padding: calc(12 * var(--pt));
  background: linear-gradient(145deg, #3b3a3e, #121114 40%, #2a292d 70%, #0b0a0c);
  box-shadow: inset 0 0 0 calc(1.5 * var(--pt)) #4a494e, inset 0 0 0 calc(4 * var(--pt)) #050505, 0 calc(40 * var(--pt)) calc(80 * var(--pt)) rgb(0 0 0 / 0.5);
}
.wr-phone .screen { position: relative; width: 100%; height: 100%; border-radius: calc(66 * var(--pt)); overflow: hidden; background: #000; }
.wr-phone .screen > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wr-phone.has-island .screen::after { content: ""; position: absolute; top: calc(11 * var(--pt)); left: 50%; translate: -50% 0; width: calc(124 * var(--pt)); height: calc(36 * var(--pt)); border-radius: 99px; background: #000; z-index: 9; }

/* Apple Watch Series 12 46mm (208×248pt screen). The coloured page is Now Playing only. */
.wr-watch {
  --pt: calc(var(--watch-w, 208px) / 208);
  position: relative; width: calc(var(--watch-w, 208px) + 36 * var(--pt)); aspect-ratio: 244 / 290;
  border-radius: calc(66 * var(--pt)); padding: calc(18 * var(--pt)) calc(18 * var(--pt));
  background: linear-gradient(150deg, #47464b, #18171a 45%, #2b2a2e 75%, #0c0b0d);
  box-shadow: inset 0 0 0 calc(1.5 * var(--pt)) #5a595e, inset 0 0 0 calc(6 * var(--pt)) #050505, 0 calc(30 * var(--pt)) calc(60 * var(--pt)) rgb(0 0 0 / 0.5);
}
.wr-watch::before { content: ""; position: absolute; right: calc(-7 * var(--pt)); top: 26%; width: calc(9 * var(--pt)); height: calc(46 * var(--pt)); border-radius: calc(4 * var(--pt)); background: linear-gradient(90deg, #2a292d, #6a696e 60%, #333236); }
.wr-watch::after { content: ""; position: absolute; right: calc(-3 * var(--pt)); top: 50%; width: calc(4 * var(--pt)); height: calc(54 * var(--pt)); border-radius: calc(2 * var(--pt)); background: #2a292d; }
.wr-watch .screen { position: relative; width: 100%; height: 100%; border-radius: calc(46 * var(--pt)); overflow: hidden; background: #000; }
.wr-watch .screen > img { width: 100%; height: 100%; object-fit: cover; display: block; }
