/* Throwaway draft G, "Day": the page is one day and scrolling moves the clock.
   Without JS (or with reduced motion) each moment paints its own sky, so the
   day still changes, in steps. With JS (.day-live) the sky is one continuous
   colour that g.js moves, and the moments become transparent. */

@font-face {
  font-family: Mukta;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/mukta-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F;
}
@font-face {
  font-family: Mukta;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/mukta-devanagari-400-normal.woff2') format('woff2');
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20B9, U+25CC, U+A8E0-A8FF;
}
@font-face {
  font-family: Mukta;
  font-weight: 600;
  font-display: swap;
  src: url('assets/fonts/mukta-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F;
}
@font-face {
  font-family: Mukta;
  font-weight: 600;
  font-display: swap;
  src: url('assets/fonts/mukta-devanagari-600-normal.woff2') format('woff2');
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20B9, U+25CC, U+A8E0-A8FF;
}
@font-face {
  font-family: Mukta;
  font-weight: 800;
  font-display: swap;
  src: url('assets/fonts/mukta-latin-800-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F;
}
@font-face {
  font-family: Mukta;
  font-weight: 800;
  font-display: swap;
  src: url('assets/fonts/mukta-devanagari-800-normal.woff2') format('woff2');
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20B9, U+25CC, U+A8E0-A8FF;
}
@font-face {
  font-family: Tiro;
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('assets/fonts/tiro-devanagari-hindi-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F;
}
@font-face {
  font-family: Tiro;
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('assets/fonts/tiro-devanagari-hindi-devanagari-400-normal.woff2') format('woff2');
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20B9, U+25CC, U+A8E0-A8FF;
}
@font-face {
  font-family: Tiro;
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  src: url('assets/fonts/tiro-devanagari-hindi-latin-400-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F;
}

:root {
  /* The live sky and ink. g.js is the only writer. The defaults are the
     first moment of the day, so the top bar is right before JS runs. */
  --sky: #1b2440;
  --ink: #fbf3e4;

  --sun: #ffb627;
  --cream: #fbf3e4;

  --gutter: clamp(1.25rem, 5vw, 5rem);
  --sans: Mukta, 'Noto Sans Devanagari', system-ui, sans-serif;
  --serif: Tiro, 'Noto Serif Devanagari', Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--sky);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font: 400 1.0625rem/1.55 var(--sans);
  color: var(--ink);
  background: var(--sky);
  overflow-x: clip;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

p,
h1,
h2,
ol {
  margin: 0;
}

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---- the sky layer (only shown when the day is live) ------------------ */

.sky {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.day-live .sky {
  display: block;
}

.sky__sun,
.sky__moon {
  position: absolute;
  top: 0;
  left: 0;
  width: clamp(4.5rem, 11vw, 9rem);
  aspect-ratio: 1;
  border-radius: 50%;
  visibility: hidden; /* g.js places them, then shows them */
}
.sky__sun {
  background: var(--sun);
}
/* A pale disc with a crisp ring: bright enough to read as the moon, faint
   enough that cream text passing over it keeps its contrast. */
.sky__moon {
  width: clamp(3.75rem, 8vw, 6.5rem);
  /* a solid soft disc, no outline: an outlined ring read as a stray circle
     whenever a headline passed over it */
  background: color-mix(in srgb, var(--cream) 24%, var(--sky));
}

.sky__stars {
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  opacity: 0;
  color: var(--cream);
  box-shadow:
    8vw 12vh 0 0,
    17vw 31vh 0 0,
    24vw 7vh 0 0.5px,
    33vw 22vh 0 0,
    41vw 44vh 0 0,
    47vw 9vh 0 0,
    56vw 27vh 0 0.5px,
    63vw 15vh 0 0,
    71vw 38vh 0 0,
    78vw 6vh 0 0,
    86vw 24vh 0 0.5px,
    93vw 41vh 0 0,
    12vw 58vh 0 0,
    29vw 71vh 0 0.5px,
    52vw 63vh 0 0,
    68vw 77vh 0 0,
    83vw 59vh 0 0,
    95vw 82vh 0 0.5px;
}

/* ---- the clock chip ---------------------------------------------------- */

.clock {
  display: none;
  position: fixed;
  z-index: 6;
  top: 0.75rem;
  right: 0.75rem;
  align-items: baseline;
  gap: 0.3rem;
  padding: 0.3rem 0.85rem 0.25rem;
  border-radius: 999px;
  background: var(--sky);
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--ink);
  font: 600 0.8125rem/1.2 var(--sans);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.day-live .clock {
  display: flex;
}
.clock--on {
  opacity: 1;
}
.clock__time {
  font: 800 1.35rem/1.2 var(--sans);
  font-variant-numeric: tabular-nums;
}
.clock__part {
  margin-left: 0.35rem;
  padding-left: 0.6rem;
  border-left: 1.5px solid currentColor;
  font-size: 0.95rem;
  line-height: 1.5;
}

@media (min-width: 56rem) {
  .clock {
    top: auto;
    right: auto;
    left: var(--gutter);
    bottom: 1.1rem;
    padding: 0.35rem 1.2rem 0.3rem;
    font-size: 1rem;
    opacity: 1; /* always in view on wide screens; there is room for it */
  }
  .clock__time {
    font-size: 2.4rem;
    line-height: 1.1;
  }
  .clock__part {
    font-size: 1.15rem;
  }
}

/* ---- top bar ----------------------------------------------------------- */

.bar {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem var(--gutter);
  color: var(--ink);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  text-decoration: none;
}
.brand__mark {
  width: 1.9rem;
  height: 1.9rem;
}
.brand__name {
  font: 800 1.2rem/1 var(--sans);
  white-space: nowrap;
}
.bar__app {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 1.1rem;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1.5px currentColor;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

/* ---- a moment in the day ---------------------------------------------- */

main {
  position: relative;
  z-index: 1;
}

.moment {
  /* --i and --s are "ink here" and "sky here". Static by default... */
  --i: var(--m-ink);
  --s: var(--m-sky);
  --soft: color-mix(in srgb, var(--i) 84%, var(--s));

  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  gap: 1.75rem;
  min-height: 92svh;
  padding: clamp(5rem, 15vh, 10rem) var(--gutter);
  background: var(--s);
  color: var(--i);
}
/* ...and following the live sky once g.js is running. */
.day-live .moment {
  --i: var(--ink);
  --s: var(--sky);
  background: none;
}

.moment__time {
  font: 600 1.15rem/1 var(--sans);
  white-space: nowrap;
}
.moment__time b {
  font: 800 clamp(4.25rem, 19vw, 6.5rem) / 0.9 var(--sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}
.moment__line {
  max-width: 24ch;
  margin-top: 0.9rem;
  font: italic 400 clamp(1.3rem, 5vw, 1.6rem) / 1.35 var(--serif);
}

/* The picture: mounted in a thin frame, like a plate in a picture book. */
.frame {
  margin: 0;
  padding: 0.5rem;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1.5px var(--i);
}
.frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px;
}
.frame--sq {
  aspect-ratio: 1;
  width: min(100%, 20rem);
}
.frame--land {
  aspect-ratio: 4 / 3;
}
.frame--wide {
  aspect-ratio: 16 / 9;
}
.frame--tall {
  aspect-ratio: 4 / 5;
  width: min(100%, 22rem);
}
/* phones: alternate which edge the smaller plates hang from */
.moment--d .frame,
.moment--a:nth-of-type(even) .frame {
  margin-left: auto;
}

.story__kind {
  font: 600 0.8125rem/1.3 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.story__title {
  margin-top: 0.5rem;
  font: 800 clamp(2rem, 8.5vw, 2.75rem) / 1.08 var(--sans);
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.story__title[lang='hi'] {
  line-height: 1.3;
  letter-spacing: 0;
}
.story__latin {
  display: block;
  margin-top: 0.15rem;
  font: 600 1rem/1.3 var(--sans);
  letter-spacing: 0.04em;
}
.story__tagline {
  max-width: 32ch;
  margin-top: 0.75rem;
  font: 400 1.2rem/1.45 var(--serif);
}
.story__tagline[lang='hi'] {
  line-height: 1.7;
}
.story__meta {
  margin: 0.6rem 0 1.4rem;
  font-size: 0.95rem;
  color: var(--soft);
}

/* One button style for the whole day: filled with the ink, lettered in the
   sky. Whatever the hour, the pair is the page's own text contrast. */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 3.1rem;
  padding: 0 1.6rem;
  border: 0;
  border-radius: 999px;
  background: var(--i);
  color: var(--s);
  font: 600 1.0625rem/1 var(--sans);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.btn svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: currentColor;
}
@media (hover: hover) {
  .btn {
    transition: transform 0.2s ease;
  }
  .btn:hover {
    transform: translateY(-2px);
  }
}

/* ---- 5:45 am: the brand rises -------------------------------------------- */

.intro {
  min-height: 100svh;
  align-content: end;
  gap: 0;
  padding-top: 6rem;
  padding-bottom: clamp(5rem, 12vh, 8rem);
}
.intro__now {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
  margin-bottom: auto;
  padding-bottom: 2rem;
  font-size: 1rem;
}
.intro__now[hidden] {
  display: none;
}
.intro__jump {
  min-height: 2.75rem;
  padding: 0 1rem;
  border: 0;
  border-radius: 999px;
  background: none;
  box-shadow: inset 0 0 0 1.5px currentColor;
  color: inherit;
  font: 600 1rem/1 var(--sans);
  cursor: pointer;
}
.intro .moment__time b {
  font-size: clamp(2.25rem, 9vw, 3.25rem);
}

.intro__title {
  margin-top: 0.75rem;
  font: 800 clamp(4rem, 19.5vw, 15rem) / 1.2 var(--sans);
  white-space: nowrap;
}
/* The horizon: the wordmark comes up from behind this line. */
.intro__mask {
  display: block;
  overflow: hidden;
  padding-top: 0.12em; /* room for the matras */
  border-bottom: 1.5px solid currentColor;
}
.intro__word {
  display: block;
}
.intro__latin {
  margin-top: 0.9rem;
  font: 600 0.8125rem/1.3 var(--sans);
  letter-spacing: 0.32em;
  text-transform: uppercase;
}
.intro__pitch {
  max-width: 30ch;
  margin-top: 1.5rem;
  font: 400 clamp(1.3rem, 5vw, 1.7rem) / 1.4 var(--serif);
}
.intro__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem 1.5rem;
  margin-top: 1.75rem;
}
.intro__hint {
  font: italic 400 1.05rem/1.3 var(--serif);
  color: var(--soft);
}

/* ---- 4:30 pm: how it works -------------------------------------------- */

.note {
  display: grid;
  gap: 1.25rem;
  padding: 0;
  list-style: none;
  counter-reset: note;
}
.note li {
  position: relative;
  max-width: 34ch;
  padding: 1rem 0 0 2.6rem;
  border-top: 1.5px solid currentColor;
  font: 400 1.15rem/1.5 var(--serif);
  counter-increment: note;
}
.note li::before {
  content: counter(note);
  position: absolute;
  left: 0;
  top: 0.75rem;
  font: 800 1.6rem/1.2 var(--sans);
}
.note b {
  display: block;
  font: 800 1.2rem/1.3 var(--sans);
}

/* ---- 2:00 am: the day closes ------------------------------------------- */

.moment--end {
  padding-bottom: 7rem; /* clear of the draft switcher */
}
.moment--end .moment__line {
  max-width: 28ch;
}
.after {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1.5px solid currentColor;
}
.after__label {
  font: 600 0.8125rem/1.3 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.after__line {
  max-width: 40ch;
  margin-top: 0.6rem;
  font: 400 1.2rem/1.45 var(--serif);
  color: var(--soft);
}

/* ---- wide screens: every moment is composed differently --------------- */

@media (min-width: 56rem) {
  .moment {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: clamp(1.25rem, 2.5vw, 2.5rem);
    row-gap: 2.25rem;
    /* cap the measure with padding, so the stepped (no-JS) sky still fills the width */
    padding-inline: max(var(--gutter), (100% - 86rem) / 2);
  }
  .moment > * {
    grid-column: 1 / -1;
  }

  .moment__time b {
    font-size: clamp(6rem, 11.5vw, 11.5rem);
  }
  .moment__line {
    font-size: clamp(1.5rem, 2.1vw, 2rem);
    max-width: 22ch;
    margin-top: 1.25rem;
  }
  .story__title {
    font-size: clamp(2.5rem, 4.2vw, 4rem);
  }
  .story__tagline {
    font-size: 1.35rem;
  }
  .frame {
    padding: 0.7rem;
  }
  .moment .frame {
    width: 100%;
    margin-left: 0;
  }

  /* a: the hour on the left, the plate hanging on the right, story under the hour */
  .moment--a .moment__when {
    grid-column: 1 / 7;
    grid-row: 1;
    align-self: end;
  }
  .moment--a .story {
    grid-column: 1 / 6;
    grid-row: 2;
  }
  .moment--a .frame {
    grid-column: 8 / 12;
    grid-row: 1 / 3;
    align-self: center;
  }

  /* b: mirrored, with a landscape plate set low on the left */
  .moment--b .frame {
    grid-column: 1 / 7;
    grid-row: 1 / 3;
    align-self: end;
  }
  .moment--b .moment__when {
    grid-column: 8 / 13;
    grid-row: 1;
    align-self: end;
  }
  .moment--b .story {
    grid-column: 8 / 13;
    grid-row: 2;
  }

  /* c: the hour and its line share the top; one wide plate; story indented under it */
  .moment--c .moment__when {
    display: grid;
    grid-template-columns: subgrid;
    grid-column: 1 / -1;
    align-items: end;
  }
  .moment--c .moment__time {
    grid-column: 1 / 7;
  }
  .moment--c .moment__line {
    grid-column: 8 / 13;
    margin-top: 0;
    padding-bottom: 0.6rem;
  }
  .moment--c .frame {
    grid-column: 2 / 12;
    aspect-ratio: 21 / 9;
  }
  .moment--c .story {
    grid-column: 6 / 12;
  }

  /* d: a small plate, a quiet hour, everything pushed to the right */
  .moment--d .moment__when {
    grid-column: 6 / 13;
    grid-row: 1;
  }
  .moment--d .frame {
    grid-column: 2 / 5;
    grid-row: 1 / 3;
    align-self: center;
  }
  .moment--d .story {
    grid-column: 6 / 12;
    grid-row: 2;
  }

  /* the note: the hour on the left, three plain rules on the right */
  .moment--note {
    min-height: 78svh;
  }
  .moment--note .moment__when {
    grid-column: 1 / 7;
  }
  .moment--note .note {
    grid-column: 8 / 13;
    align-self: end;
  }

  .intro {
    align-content: end;
  }
  .intro > * {
    grid-column: 1 / -1;
  }
  .intro__pitch {
    grid-column: 1 / 7;
    max-width: 26ch;
    font-size: clamp(1.6rem, 2.3vw, 2.2rem);
  }
  .intro__actions {
    grid-column: 1 / 9;
  }
  .intro .moment__time b {
    font-size: 3.5rem;
  }
  .intro__title {
    font-size: clamp(8rem, 16.5vw, 17rem);
    line-height: 1.16;
  }
  .intro {
    row-gap: 0;
    padding-bottom: 6.5rem; /* clear of the clock chip and the switcher */
  }

  .moment--end .moment__when,
  .moment--end .end__actions {
    grid-column: 1 / 8;
  }
  .moment--end .after {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .clock {
    transition: none;
  }
}
