/* BeMindful front page. The app's own room: warm near-black, two warm lights, off-white ink, Instrument Serif for every word.
   One screen. On a phone (it is opened from TikTok, Instagram and Substack, inside their browsers) it is laid out like the app's
   store pictures: the line, then the iPhone running off the bottom, and the store button always in reach. */
@font-face { font-family: "Instrument Serif"; src: url("fonts/instrument-serif-regular.woff2") format("woff2"); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("fonts/instrument-serif-italic.woff2") format("woff2"); font-style: italic; font-weight: 400; font-display: swap; }

:root {
  --room: #140d09; --ink: #efe9dd; --quiet: rgb(239 233 221 / .66); --hair: rgb(239 233 221 / .16);
  --serif: "Instrument Serif", "Iowan Old Style", Palatino, Georgia, serif;
  --pad: 22px;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--room); -webkit-text-size-adjust: 100%; }
body { color: var(--ink); font-family: var(--serif); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: hidden; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 8px; }

/* ---------- phone first ---------- */
.room { position: relative; isolation: isolate; overflow: hidden; }
.room::before { content: ""; position: absolute; inset: 0; z-index: -2;
  background:
    radial-gradient(90% 46% at 14% -4%, rgb(214 150 92 / .22), rgb(214 150 92 / 0) 70%),
    radial-gradient(80% 50% at 50% 62%, rgb(196 120 62 / .20), rgb(196 120 62 / 0) 72%); }
.room::after { content: ""; position: absolute; inset: 0; z-index: -1; background: url("img/grain.png"); background-size: 160px; opacity: .05; mix-blend-mode: overlay; pointer-events: none; }

.mark { display: flex; align-items: center; gap: 11px; padding: calc(env(safe-area-inset-top, 0px) + 16px) var(--pad) 0; }
.mark img { width: 34px; height: 34px; border-radius: 8.5px; box-shadow: 0 6px 18px rgb(0 0 0 / .5), 0 0 0 1px rgb(239 233 221 / .07); }
.mark span { font-size: 23px; letter-spacing: .005em; }
.moon { margin-left: auto; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: rgb(239 233 221 / .78);
  background: rgb(239 233 221 / .05); border: 1px solid rgb(239 233 221 / .14); transition: background .25s ease, color .25s ease; -webkit-tap-highlight-color: transparent; }
.moon:hover { background: rgb(239 233 221 / .1); color: var(--ink); }
.moon[aria-pressed="true"] { background: rgb(239 233 221 / .16); color: var(--ink); }
.moon[aria-pressed="true"] path { fill: currentColor; }

/* late sun through a window, on the wall behind the words (the Attention room) */
.sun { position: absolute; z-index: -1; left: -8%; top: 3%; width: min(120vw, 860px); aspect-ratio: 1.18; pointer-events: none; opacity: .62;
  transform: skewY(-7deg) skewX(-16deg); filter: blur(14px);
  background:
    linear-gradient(90deg, rgb(20 13 9 / 0) 0 31.6%, rgb(20 13 9 / .8) 31.6% 34.4%, rgb(20 13 9 / 0) 34.4% 65.6%, rgb(20 13 9 / .8) 65.6% 68.4%, rgb(20 13 9 / 0) 68.4%),
    linear-gradient(0deg, rgb(20 13 9 / 0) 0 31.6%, rgb(20 13 9 / .8) 31.6% 34.4%, rgb(20 13 9 / 0) 34.4% 65.6%, rgb(20 13 9 / .8) 65.6% 68.4%, rgb(20 13 9 / 0) 68.4%),
    linear-gradient(155deg, rgb(226 168 110 / .30), rgb(206 140 84 / .12) 60%, rgb(206 140 84 / .03));
  -webkit-mask-image: radial-gradient(closest-side at 50% 50%, #000 18%, transparent 96%); mask-image: radial-gradient(closest-side at 50% 50%, #000 18%, transparent 96%); }

/* one screen tall: mark, words, then the iPhone takes what is left and runs off the bottom */
/* the room fills the whole screen, under the browser's floating bar too; --bar is how much of it that bar covers */
:root { --bar: 0px; }
@supports (height: 100lvh) { :root { --bar: calc(100lvh - 100svh); } }
.room { height: 100vh; height: 100lvh; min-height: 520px; display: flex; flex-direction: column; }
.hero { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.words { text-align: center; padding: clamp(18px, 3.6svh, 34px) var(--pad) 0; }
h1 { font-weight: 400; font-size: min(12.6vw, 7.4svh, 60px); line-height: .98; letter-spacing: -.012em; text-wrap: balance; }
h1 .l1, h1 .l2 { display: block; }
h1 .l2 { font-style: italic; color: rgb(239 233 221 / .86); padding-top: .04em; }
.w { display: inline-block; white-space: nowrap; }
.typing .c { opacity: 0; }
.typing .c.on { opacity: 1; }
.lede { font-size: min(4.9vw, 21px); line-height: 1.3; color: var(--quiet); margin: clamp(10px, 1.8svh, 16px) auto 0; max-width: 17em; text-wrap: balance; }
.lede span { display: none; }

.stage { flex: 1; min-height: 0; position: relative; margin-top: clamp(18px, 3.4svh, 34px); }
.phone { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: min(76vw, 340px); aspect-ratio: 1470 / 3000; }
.phone::before { content: ""; position: absolute; inset: -6% -34% 30%; z-index: -1; background: radial-gradient(closest-side, rgb(214 150 92 / .22), rgb(214 150 92 / 0)); }
.phone video { position: absolute; left: 5.1%; top: 2.2%; width: 89.8%; height: 95.6%; object-fit: cover; border-radius: 12.2% / 5.6%; background: #0a0604; }
.phone .frame { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; filter: drop-shadow(0 30px 50px rgb(0 0 0 / .55)); }
/* the room's dark comes up over the phone, as in the store pictures; the store button rests on it */
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: calc(min(34%, 230px) + var(--bar)); pointer-events: none;
  background: linear-gradient(180deg, rgb(15 9 6 / 0), rgb(15 9 6 / .5) 30%, rgb(15 9 6 / .9) 62%, #0f0906 92%); }
.get { position: absolute; z-index: 2; left: 0; right: 0; bottom: calc(var(--bar) + env(safe-area-inset-bottom, 0px) + clamp(18px, 3.4svh, 30px));
  display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 var(--pad); }
.store { display: block; border-radius: 12px; line-height: 0; box-shadow: 0 14px 40px rgb(0 0 0 / .6); -webkit-tap-highlight-color: transparent; -webkit-touch-callout: default; }
.store img { height: 58px; width: auto; display: block; pointer-events: none; }
.store:active { transform: scale(.98); }
/* only inside TikTok's browser */
#hold-hint { font-size: 20px; line-height: 1.25; margin-bottom: 14px; text-wrap: balance; text-shadow: 0 1px 12px rgb(0 0 0 / .8); }
#hold-hint strong { font-weight: 400; font-style: italic; }
#help { margin-top: 12px; font-size: 16px; color: var(--quiet); max-width: 21em; }
#help summary { cursor: pointer; list-style: none; text-decoration: underline; text-decoration-color: rgb(239 233 221 / .35); text-underline-offset: .2em; }
#help summary::-webkit-details-marker { display: none; }
#help p { margin-top: 10px; line-height: 1.35; }
#help b { font-weight: 400; color: var(--ink); }
#copy { margin-top: 12px; font: inherit; color: var(--ink); background: rgb(239 233 221 / .07); border: 1px solid rgb(239 233 221 / .28); border-radius: 999px; padding: 9px 20px; cursor: pointer; }
#result { word-break: break-all; }
#result:empty { display: none; }
.tiktok .hero::after { height: calc(min(52%, 340px) + var(--bar)); }
.tiktok #help[open] { background: rgb(15 9 6 / .92); border-radius: 16px; padding: 12px 16px 16px; }

.foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; font-size: 16px; color: rgb(239 233 221 / .58);
  padding: 104px var(--pad) calc(env(safe-area-inset-bottom, 0px) + 26px); background: #0f0906; }
.foot a { text-decoration: none; color: rgb(239 233 221 / .72); }
.foot a:hover { color: var(--ink); }
.foot span { flex-basis: 100%; text-align: center; }

/* ---------- wide screens: words on the left, the whole iPhone on the right, nothing to scroll ---------- */
@media (min-width: 900px) and (min-height: 560px) {
  :root { --pad: clamp(40px, 6.5vw, 110px); }
  body { height: 100vh; height: 100svh; display: flex; flex-direction: column; overflow: hidden; }
  :root { --bar: 0px; }
  .room { flex: 1; height: auto; min-height: 0; }
  .room::before { background:
    radial-gradient(70% 55% at 12% -6%, rgb(214 150 92 / .20), rgb(214 150 92 / 0) 70%),
    radial-gradient(46% 62% at 76% 52%, rgb(196 120 62 / .24), rgb(196 120 62 / 0) 72%),
    radial-gradient(120% 90% at 50% 110%, rgb(0 0 0 / .5), rgb(0 0 0 / 0) 60%); }
  .sun { left: -4%; top: 4%; width: min(62vw, 860px); }
  .mark { padding-top: 30px; }
  .mark img { width: 40px; height: 40px; border-radius: 10px; }
  .mark span { font-size: 26px; }
  .moon { width: 42px; height: 42px; }
  .hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); grid-template-rows: 1fr auto auto 1fr; column-gap: clamp(24px, 4vw, 72px); padding: 0 var(--pad); }
  .hero::after { display: none; }
  .words { grid-column: 1; grid-row: 2; text-align: left; padding: 0; container-type: inline-size; }
  h1 { font-size: min(15.2cqw, 14.5svh, 128px); text-wrap: wrap; }
  .lede { font-size: clamp(21px, 1.7vw, 27px); margin: clamp(18px, 3svh, 30px) 0 0; max-width: 19.5em; }
  .lede span { display: inline; }
  .get { position: static; grid-column: 1; grid-row: 3; align-items: flex-start; text-align: left; padding: 0; margin-top: clamp(26px, 4.4svh, 44px); }
  .store { box-shadow: none; transition: transform .25s ease, filter .25s ease; }
  .store:hover { transform: translateY(-1px); filter: brightness(1.06); }
  .store:active { transform: none; }
  .store img { height: 62px; }
  .stage { grid-column: 2; grid-row: 1 / -1; margin: 0; display: grid; place-items: center; min-height: 0; }
  .phone { position: relative; left: auto; top: auto; transform: none; width: auto; height: min(82svh, 860px); }
  .phone::before { inset: -8% -40%; }
  .foot { justify-content: flex-start; background: none; padding: 16px var(--pad) 20px; }
  .foot span { flex-basis: auto; margin-left: auto; }
}

/* sleep mode: grey x pure red, as in the app (green and blue go to zero) */
.room, .foot { transition: filter .9s ease; }
body::after { content: ""; position: fixed; inset: 0; z-index: 9; background: #f00; mix-blend-mode: multiply; pointer-events: none; opacity: 0; transition: opacity .9s ease; }
.sleep .room, .sleep .foot { filter: grayscale(1) brightness(.82) contrast(1.08); }
.sleep body::after { opacity: 1; }
html.sleep { background: #0c0000; }
@media (prefers-reduced-motion: reduce) { .store, .room, .foot, body::after, .moon { transition: none; } }
