/* Hallmark · genre: playful · page: insights ("The Titik Journal") · theme: custom (site tokens) · tone: playful-bold · anchor hue: 265
 * idea: the archive is a book — six notes per spread, page numbers in the corners, and the
 * pagination turns the leaf (insights.js). Each topic has its own arrangement of the three
 * dots, which fall into a row — the "…" — when you point at a note.
 * sections: masthead banner · cover story · archive (topics · book · pager)
 */

/* Banner: a newspaper masthead over the big title ----------------------------- */

.i-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, var(--page-max));
  justify-content: center;
  padding: calc(var(--header-h) + var(--promo-h, 2.5rem) + var(--ruler-offset, 0px) + var(--space-xl)) var(--gutter) var(--space-3xl);
}

.i-hero__grid {
  mask-image: linear-gradient(to bottom, var(--color-ink) 55%, transparent);
}

.i-hero > :not(canvas) {
  position: relative;
  z-index: 1;
}

.i-hero__masthead {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2xs) var(--space-lg);
  margin-block-end: var(--space-xl);
  padding-block: var(--space-xs);
  border-block: 3px solid var(--color-ink);
  box-shadow: inset 0 -5px 0 -4px var(--color-ink); /* the thin second rule under the thick one */
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.i-hero__name {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 400;
  letter-spacing: 0.04em;
}

.i-hero__title {
  min-width: 0;
  font-family: var(--font-display);
  font-size: var(--text-hero);
  font-weight: 400;
  line-height: var(--leading-hero);
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.i-hero__line {
  display: block;
}

@media (min-width: 48rem) {
  .i-hero__line + .i-hero__line {
    text-align: end;
  }
}

.i-hero__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: var(--space-lg) var(--space-xl);
  margin-block-start: var(--space-xl);
}

.i-hero__lede {
  max-width: 36ch;
  font-size: var(--text-md);
  font-weight: 500;
  line-height: 1.45;
}

.i-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

/* Meta line: topic · date · reading time ------------------------------------- */

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2xs) var(--space-xs);
  color: var(--color-muted);
  font-size: var(--text-xs);
  font-weight: 600;
}

.meta > * + *::before {
  content: "·";
  margin-inline-end: var(--space-xs);
}

.meta__topic {
  color: var(--color-blue-deep);
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Cover story ------------------------------------------------------------------ */

.cover {
  padding: 0 var(--gutter) var(--space-4xl);
}

.cover__card {
  --color-focus: var(--color-blue-soft);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  max-width: var(--page-max);
  margin-inline: auto;
  border-radius: var(--radius-lg);
  background-color: var(--color-ink);
  color: var(--color-paper);
}

@media (min-width: 56rem) {
  .cover__card {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  }
}

.cover__media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

.cover__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: scale var(--dur-reveal) var(--ease-out);
}

.cover__badge {
  position: absolute;
  inset-block-start: var(--space-md);
  inset-inline-start: var(--space-md);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  background-color: var(--color-lime);
  color: var(--color-ink);
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.cover__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-xl) var(--space-lg);
}

@media (min-width: 56rem) {
  .cover__body {
    justify-content: center;
    padding: var(--space-2xl) var(--space-xl);
  }
}

.cover__body .meta {
  color: var(--color-muted-dark);
}

.cover__body .meta__topic {
  color: var(--color-blue-soft);
}

.cover__title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 400;
  line-height: var(--leading-tight);
  text-transform: uppercase;
  text-wrap: balance;
}

.cover__title a {
  text-decoration: none;
}

/* The whole card is the link. */
.cover__title a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.cover__title a:focus-visible {
  outline: none;
}

.cover__title a:focus-visible::after {
  border-radius: var(--radius-lg);
  outline: 2px solid var(--color-focus);
  outline-offset: -4px;
}

.cover__excerpt {
  max-width: 44ch;
  color: var(--color-muted-dark);
  font-size: var(--text-md);
  line-height: 1.5;
}

.cover__more {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  margin-block-start: var(--space-xs);
  font-weight: 700;
}

.cover__more::after {
  content: "→";
  transition: translate var(--dur-long) var(--ease-out);
}

@media (hover: hover) {
  .cover__card:hover .cover__media img {
    scale: 1.04;
  }

  .cover__card:hover .cover__more::after {
    translate: 0.3rem 0;
  }
}

/* Archive ----------------------------------------------------------------------- */

.archive {
  padding: var(--space-4xl) var(--gutter);
  background-color: var(--color-paper-2);
}

.archive__inner {
  display: grid;
  gap: var(--space-2xl);
  max-width: var(--page-max);
  margin-inline: auto;
}

.journal {
  display: grid;
  gap: var(--space-lg);
}

.journal[aria-busy="true"] {
  cursor: progress;
}

/* Topic filter */
.topics__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.topic {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: 2.75rem;
  padding: 0 var(--space-md) 0 var(--space-sm);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-pill);
  background-color: var(--color-paper);
  color: var(--color-ink);
  font-size: var(--text-sm);
  font-weight: 650;
  text-decoration: none;
  transition: border-color var(--dur-short) var(--ease-out), background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out);
}

.topic:first-child,
.topics__list li:first-child .topic {
  padding-inline-start: var(--space-md);
}

.topic[aria-current="page"] {
  border-color: var(--color-ink);
  background-color: var(--color-ink);
  color: var(--color-paper);
}

@media (hover: hover) {
  .topic:not([aria-current="page"]):hover {
    border-color: var(--color-ink);
  }
}

.journal__status {
  justify-self: start;
  color: var(--color-muted);
  font-size: var(--text-sm);
  font-weight: 600;
}

.journal__status:focus {
  outline: none;
}

.journal__status:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 4px;
}

/* The book ------------------------------------------------------------------------
 * One column on small screens; from 56rem two leaves either side of the spine. */

.book {
  --leaf-radius: var(--radius-md);
  --entry-h: 11.5rem;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border-radius: var(--leaf-radius);
  /* box-shadow, not filter: a filter would repaint the whole book on every frame of a turn */
  box-shadow: 0 1.75rem 2.25rem -1.5rem color-mix(in oklch, var(--color-ink) 24%, transparent);
  perspective: 2800px;
}

/* On one column, an empty right-hand page has nothing to show. */
@media (max-width: 55.99rem) {
  .leaf__blank {
    display: none;
  }
}

@media (min-width: 56rem) {
  .book {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* A leaf: paper with faint blue rules, page number at the outer bottom corner. */
.leaf {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: var(--space-lg) var(--space-lg) var(--space-md);
  background-color: var(--color-paper);
  background-image: repeating-linear-gradient(to bottom, transparent 0 calc(2rem - 1px), color-mix(in oklch, var(--color-blue) 7%, transparent) calc(2rem - 1px) 2rem);
}

.leaf--left {
  border-radius: var(--leaf-radius) var(--leaf-radius) 0 0;
}

.leaf--right {
  border-radius: 0 0 var(--leaf-radius) var(--leaf-radius);
}

@media (min-width: 56rem) {
  .leaf {
    padding: var(--space-xl) var(--space-xl) var(--space-lg);
  }

  /* Darker toward the spine, like a real gutter; a stack of pages along the outer edge. */
  .leaf--left {
    border-radius: var(--leaf-radius) 0 0 var(--leaf-radius);
    background-image:
      linear-gradient(to left, color-mix(in oklch, var(--color-ink) 9%, transparent), transparent 3rem),
      repeating-linear-gradient(to bottom, transparent 0 calc(2rem - 1px), color-mix(in oklch, var(--color-blue) 7%, transparent) calc(2rem - 1px) 2rem);
    box-shadow:
      -3px 3px 0 -1px var(--color-paper),
      -3px 3px 0 0 var(--color-rule),
      -6px 6px 0 -1px var(--color-paper),
      -6px 6px 0 0 var(--color-rule);
  }

  .leaf--right {
    border-radius: 0 var(--leaf-radius) var(--leaf-radius) 0;
    background-image:
      linear-gradient(to right, color-mix(in oklch, var(--color-ink) 9%, transparent), transparent 3rem),
      repeating-linear-gradient(to bottom, transparent 0 calc(2rem - 1px), color-mix(in oklch, var(--color-blue) 7%, transparent) calc(2rem - 1px) 2rem);
    box-shadow:
      3px 3px 0 -1px var(--color-paper),
      3px 3px 0 0 var(--color-rule),
      6px 6px 0 -1px var(--color-paper),
      6px 6px 0 0 var(--color-rule);
  }
}

.leaf__entries {
  display: grid;
}

@media (min-width: 56rem) {
  /* Fixed rows, so every spread is the same height and the turning leaf lines up. */
  .leaf__entries {
    grid-auto-rows: var(--entry-h);
  }

  .leaf__entries,
  .leaf__end,
  .leaf__blank {
    min-height: calc(3 * var(--entry-h));
  }

  .leaf__entries + .leaf__end {
    min-height: 0;
  }
}

.book__spine {
  display: none;
}

@media (min-width: 56rem) {
  .book__spine {
    position: absolute;
    inset-block: 0;
    left: 50%;
    z-index: 2;
    display: block;
    width: 2px;
    background-image: linear-gradient(to bottom, var(--color-rule), color-mix(in oklch, var(--color-ink) 22%, var(--color-rule)) 50%, var(--color-rule));
    translate: -50% 0;
  }
}

/* One note */
.entry {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: var(--space-md);
  padding-block: var(--space-md);
  border-block-end: var(--rule-hair) solid var(--color-rule);
}

.entry:last-child {
  border-block-end: 0;
}

.entry__text {
  display: grid;
  gap: var(--space-xs);
  min-width: 0;
}

.entry__no {
  color: var(--color-ink);
  font-weight: 800;
}

.entry__title {
  display: -webkit-box;
  overflow: hidden;
  font-size: var(--text-md);
  font-weight: 750;
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-wrap: balance;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.entry__title a {
  text-decoration: none;
}

/* The whole note is the link. */
.entry__title a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.entry__title a:focus-visible {
  outline: none;
}

.entry__title a:focus-visible::after {
  border-radius: var(--space-xs);
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.entry__excerpt {
  display: -webkit-box;
  overflow: hidden;
  color: var(--color-muted);
  font-size: var(--text-sm);
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

@media (hover: hover) {
  .entry:hover .entry__title {
    text-decoration: underline;
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.18em;
  }
}

.leaf__folio {
  margin-block-start: auto;
  padding-block-start: var(--space-sm);
  color: var(--color-muted);
  font-family: var(--font-display);
  font-size: var(--text-md);
  line-height: 1;
}

.leaf__folio::before,
.leaf__folio::after {
  content: " — ";
  color: var(--color-rule);
}

.leaf--right .leaf__folio {
  text-align: end;
}

.leaf__end {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: var(--space-sm);
  padding-block: var(--space-xl);
  color: var(--color-muted);
}

.leaf__end-title {
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  line-height: var(--leading-tight);
  text-transform: uppercase;
}

.leaf__blank {
  display: grid;
  place-items: center;
  opacity: 0.6;
}

.leaf__blank .dots {
  width: 6rem;
}

/* Dog-ears: the folded bottom corners turn the page too (mouse only; the pager below is
 * the accessible way). */
.book__corner {
  position: absolute;
  inset-block-end: 0;
  z-index: 3;
  width: 3rem;
  height: 3rem;
  transition: width var(--dur-long) var(--ease-out), height var(--dur-long) var(--ease-out);
}

.book__corner--next {
  inset-inline-end: 0;
  border-start-start-radius: 0.5rem;
  border-end-end-radius: var(--leaf-radius);
  background-image: linear-gradient(315deg, var(--color-paper-2) 0 50%, color-mix(in oklch, var(--color-paper) 82%, var(--color-blue)) 50%);
  box-shadow: -0.2rem -0.2rem 0.5rem -0.3rem var(--color-shadow);
}

.book__corner--prev {
  inset-inline-start: 0;
  border-start-end-radius: 0.5rem;
  border-end-start-radius: var(--leaf-radius);
  background-image: linear-gradient(45deg, var(--color-paper-2) 0 50%, color-mix(in oklch, var(--color-paper) 82%, var(--color-blue)) 50%);
  box-shadow: 0.2rem -0.2rem 0.5rem -0.3rem var(--color-shadow);
}

@media (hover: hover) {
  .book__corner:hover {
    width: 4.75rem;
    height: 4.75rem;
  }
}

/* The turning leaf (insights.js) ---------------------------------------------------- */

.flipper {
  position: absolute;
  inset-block: 0;
  z-index: 4;
  transform-style: preserve-3d;
  pointer-events: none;
}

.flipper--next {
  left: 50%;
  width: 50%;
  transform-origin: 0% 50%;
}

.flipper--prev {
  left: 0;
  width: 50%;
  transform-origin: 100% 50%;
}

.flipper--whole {
  inset-inline: 0;
  transform-origin: 0% 50%;
}

.flipper__face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.flipper__face--back {
  transform: rotateY(180deg);
}

.flipper__face > .leaf,
.flipper__sheet {
  height: 100%;
}

.flipper__sheet {
  display: grid;
  align-content: start;
}

/* Light and shadow across the turning leaf. */
.flipper__shade {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(to right, color-mix(in oklch, var(--color-ink) 30%, transparent), transparent 60%);
  opacity: 0;
  pointer-events: none;
}

.flipper--prev .flipper__face--front .flipper__shade,
.flipper--next .flipper__face--back .flipper__shade {
  background-image: linear-gradient(to left, color-mix(in oklch, var(--color-ink) 30%, transparent), transparent 60%);
}

/* Pager ---------------------------------------------------------------------------- */

.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--space-sm) var(--space-lg);
  margin-block-start: var(--space-md);
}

.pager__step {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: 2.75rem;
  padding: 0 var(--space-sm);
  color: var(--color-ink);
  font-weight: 700;
  text-decoration: none;
}

span.pager__step {
  color: var(--color-muted);
  opacity: 0.5;
}

a.pager__step span {
  transition: translate var(--dur-long) var(--ease-out);
}

@media (hover: hover) {
  a.pager__step[rel="next"]:hover span[aria-hidden] {
    translate: 0.25rem 0;
  }

  a.pager__step[rel="prev"]:hover span[aria-hidden] {
    translate: -0.25rem 0;
  }
}

.pager__pages {
  display: flex;
  gap: var(--space-xs);
}

/* Page numbers are dots: a ring, filled blue for the page you're on. */
.pager__page {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: 50%;
  background-color: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: var(--text-md);
  text-decoration: none;
  transition: border-color var(--dur-short) var(--ease-out), background-color var(--dur-short) var(--ease-out), scale var(--dur-short) var(--ease-out);
}

.pager__page[aria-current="page"] {
  border-color: var(--color-blue);
  background-color: var(--color-blue);
  color: var(--color-paper);
  scale: 1.08;
}

@media (hover: hover) {
  .pager__page:not([aria-current="page"]):hover {
    border-color: var(--color-ink);
  }
}

/* The three dots, one arrangement per topic --------------------------------------
 * Each dot sits at (--xN, --yN) inside a rounded tile. Pointing at a note (or a topic)
 * lines them up into a row: the "…" of the logo. */

.dots {
  --x1: 25%; --y1: 50%;
  --x2: 50%; --y2: 50%;
  --x3: 75%; --y3: 50%;
  --dots-bg: var(--color-paper-2);
  --dots-ink: var(--color-ink);
  --dot: 22%;
  position: relative;
  display: block;
  flex: none;
  width: 4.5rem;
  aspect-ratio: 1;
  border-radius: 0.9rem;
  background-color: var(--dots-bg);
}

.dots i {
  position: absolute;
  width: var(--dot);
  aspect-ratio: 1;
  border-radius: 50%;
  background-color: var(--dots-ink);
  translate: -50% -50%;
  transition:
    left var(--dur-long) var(--ease-out),
    top var(--dur-long) var(--ease-out);
}

.dots i:nth-child(1) { left: var(--x1); top: var(--y1); }
.dots i:nth-child(2) { left: var(--x2); top: var(--y2); transition-delay: 40ms; }
.dots i:nth-child(3) { left: var(--x3); top: var(--y3); transition-delay: 80ms; }

.dots--guide {       /* a path, step by step */
  --x1: 26%; --y1: 26%;
  --x2: 50%; --y2: 50%;
  --x3: 74%; --y3: 74%;
  --dots-bg: var(--color-blue);
  --dots-ink: var(--color-paper);
}

.dots--design {      /* a composition */
  --x1: 50%; --y1: 28%;
  --x2: 28%; --y2: 70%;
  --x3: 72%; --y3: 70%;
  --dots-bg: var(--color-lime);
  --dots-ink: var(--color-ink);
}

.dots--development { /* a stack */
  --x1: 50%; --y1: 24%;
  --x2: 50%; --y2: 50%;
  --x3: 50%; --y3: 76%;
  --dots-bg: var(--color-ink);
  --dots-ink: var(--color-lime);
}

.dots--ecommerce {   /* a basket */
  --x1: 28%; --y1: 34%;
  --x2: 72%; --y2: 34%;
  --x3: 50%; --y3: 72%;
  --dots-bg: color-mix(in oklch, var(--color-blue) 16%, var(--color-paper));
  --dots-ink: var(--color-blue);
}

.dots--seo {         /* rising */
  --x1: 26%; --y1: 74%;
  --x2: 50%; --y2: 52%;
  --x3: 74%; --y3: 28%;
  --dots-bg: var(--color-blue-deep);
  --dots-ink: var(--color-blue-soft);
}

.dots--studio {      /* the logo's row, already */
  --dots-bg: var(--color-paper);
  --dots-ink: var(--color-blue);
  box-shadow: inset 0 0 0 1px var(--color-rule);
}

.dots--end {
  --dots-bg: transparent;
  --dots-ink: var(--color-rule);
}

.entry:hover .dots,
.entry:focus-within .dots,
.topic:hover .dots {
  --x1: 25%; --y1: 50%;
  --x2: 50%; --y2: 50%;
  --x3: 75%; --y3: 50%;
}

.topic__dots {
  width: 1.5rem;
  border-radius: 0.4rem;
}

.topic[aria-current="page"] .topic__dots {
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--color-paper) 40%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  .dots i {
    transition: none;
  }
}
