/* The newsletter nav whose pill collects the new-post counts: the top bar of a made-up weekly newsletter, Slow
   Margins, alone on white. A dark ink pill marks the section you are on; the new-post badges are tangerine. */
:root {
  --fondo: #ffffff;                       /* the page */
  --barra: #fcfbf9;                       /* the bar, a warm paper white */
  --barra-giu: #f6f4f0;                   /* the bar, at the bottom */
  --filo: rgba(28, 24, 20, 0.085);        /* the 1px edge of the bar */
  --inchiostro: #19171c;                  /* the name, the pill and the current text */
  --inchiostro-2: #2c2930;                /* the top of the pill */
  --grigio: #77726c;                      /* the other sections */
  --grigio-chiaro: #a29d96;               /* the unread line */
  --fantasma: #efece7;                    /* the soft pill under the pointer */
  --accento: #f0582c;                     /* the badges and Subscribe */
  --accento-2: #ff7a45;                   /* the top of Subscribe */
}

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

html { touch-action: manipulation; }

html, body {
  margin: 0;
  overflow-x: clip;
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 16px 12px;
  overflow: hidden;
}

a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
a:focus, button:focus { outline: none; }

.sr {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- the bar */
.nav {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  width: min(720px, 100%);
  height: 60px;
  padding: 0 10px 0 12px;
  border-radius: 20px;
  background: linear-gradient(180deg, var(--barra), var(--barra-giu));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 0 0 1px var(--filo),
    0 1px 1px rgba(28, 24, 20, 0.04),
    0 4px 10px -4px rgba(28, 24, 20, 0.07),
    0 18px 36px -18px rgba(28, 24, 20, 0.18),
    0 40px 70px -40px rgba(28, 24, 20, 0.16);
  isolation: isolate;
}

.nav__grain {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: multiply;
  z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------- the name */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  border-radius: 10px;
}

.brand__mark { display: block; width: 32px; height: 32px; flex: none; }
.brand__mark svg { display: block; width: 100%; height: 100%; overflow: visible; }
.m__tile { fill: var(--inchiostro); stroke: rgba(255, 255, 255, 0.12); stroke-width: 1; }
.m__page { fill: #fbf8f2; }
.m__fold { fill: none; stroke: #d8d2c8; stroke-width: 1.1; stroke-linejoin: round; }
.m__line { fill: none; stroke: var(--accento); stroke-width: 1.5; stroke-linecap: round; }

.brand__text { display: grid; gap: 1px; line-height: 1; }
.brand__name {
  font-family: "Newsreader Variable", "Newsreader", Georgia, serif;
  font-style: italic;
  font-variation-settings: "opsz" 36;
  font-weight: 520;
  font-size: 18.5px;
  letter-spacing: -0.015em;
}
.brand__meta {
  display: flex;
  align-items: center;
  font-size: 10.5px;
  line-height: 1.2;
  font-weight: 520;
  font-stretch: 92%;
  letter-spacing: 0.01em;
  color: var(--grigio-chiaro);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.brand__sep { margin: 0 4px; }
.brand__done { display: inline-flex; align-items: center; gap: 3px; color: var(--inchiostro); }
.brand__done svg { width: 9px; height: 9px; fill: none; stroke: var(--accento); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* a rolling slot: the old text leaves, the new one comes in, both in the same grid cell */
.roll {
  position: relative;
  display: inline-grid;
  overflow: hidden;
  vertical-align: top;
  line-height: 1.2;
}
.roll > * { grid-area: 1 / 1; justify-self: start; white-space: nowrap; }

/* ---------------------------------------------------------------- the sections */
.links {
  --slot: 22px;
  position: relative;
  display: flex;
  align-items: center;
  height: 36px;
  flex: none;
}

.link {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border-radius: 18px;
  font-size: 14px;
  font-weight: 540;
  font-stretch: 100%;
  letter-spacing: -0.005em;
  color: var(--grigio);
  transition: color 0.35s ease, font-weight 0.35s ease;
  cursor: pointer;
}
.link__word { display: block; white-space: nowrap; }
.link.is-hover { color: var(--inchiostro); }
.link.is-on { color: #fff; font-weight: 600; }
.link:focus-visible { box-shadow: 0 0 0 2px var(--fondo), 0 0 0 3.5px var(--accento); }

/* the slot keeps the room of a badge; GSAP closes it to 0 once the section is caught up */
.slot { position: relative; display: block; width: var(--slot); height: 18px; flex: none; }
.chip {
  position: absolute;
  left: 4px;
  top: 0;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: linear-gradient(180deg, var(--accento-2), var(--accento));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 1px 2px rgba(150, 40, 10, 0.28), 0 3px 8px -3px rgba(240, 88, 44, 0.55);
  color: #fff;
  font-size: 10.5px;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.chip > * { grid-area: 1 / 1; }
.chip .roll { line-height: 1.25; }
.chip__tick { width: 11px; height: 11px; fill: none; stroke: #fff; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }

/* the dark pill and the soft one under the pointer: the ticker moves them on two springs */
.pill, .ghost {
  position: absolute;
  left: 0;
  top: 0;
  height: 36px;
  width: 60px;
  border-radius: 18px;
  pointer-events: none;
}
.ghost { z-index: 0; background: var(--fantasma); opacity: 0; box-shadow: inset 0 0 0 1px rgba(28, 24, 20, 0.04); }
.pill { z-index: 1; }
.pill__press, .pill__face { position: absolute; inset: 0; border-radius: inherit; }
.pill__face {
  background: linear-gradient(180deg, var(--inchiostro-2), var(--inchiostro) 60%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3),
    0 1px 2px rgba(20, 16, 12, 0.22),
    0 6px 14px -6px rgba(20, 16, 12, 0.45),
    0 14px 26px -14px rgba(20, 16, 12, 0.35);
}
/* the light that crosses the pill when a section is caught up */
.pill__sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}
.pill__sheen::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 45%;
  transform: translateX(var(--sx, -120%)) skewX(-18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 140, 90, 0.22), rgba(255, 255, 255, 0.18), transparent);
}
/* a thin light on the pill's top edge */
.pill__face::after {
  content: "";
  position: absolute;
  left: 14%;
  right: 14%;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
}

/* ---------------------------------------------------------------- Subscribe */
.sub {
  position: relative;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px 0 13px;
  border: 0;
  border-radius: 14px;
  overflow: hidden;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(180deg, var(--accento-2), var(--accento));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(120, 30, 5, 0.25),
    0 1px 2px rgba(150, 40, 10, 0.3),
    0 8px 18px -8px rgba(240, 88, 44, 0.7);
  transition: background 0.45s ease, box-shadow 0.45s ease;
  -webkit-tap-highlight-color: transparent;
}
.sub.is-done {
  background: linear-gradient(180deg, var(--inchiostro-2), var(--inchiostro));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 1px 2px rgba(20, 16, 12, 0.3), 0 8px 18px -8px rgba(20, 16, 12, 0.55);
}
.sub:focus-visible { outline: 2px solid var(--accento); outline-offset: 3px; }
.sub__light {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(70px 50px at var(--gx, 50%) var(--gy, 0%), rgba(255, 255, 255, 0.4), transparent 70%);
  mix-blend-mode: soft-light;
}
.sub__icon { position: relative; width: 16px; height: 16px; flex: none; }
.sub__icon svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.sub__tick { stroke: var(--accento-2); stroke-width: 1.9; opacity: 0; }
.sub__label { position: relative; }

@media (hover: hover) {
  .sub:hover .sub__light { opacity: 1; }
}

/* ---------------------------------------------------------------- phone: two rows, the same gestures */
@media (max-width: 600px) {
  .nav {
    display: grid;
    grid-template-columns: auto auto;
    grid-template-areas: "brand sub" "links links";
    row-gap: 6px;
    column-gap: 10px;
    height: auto;
    padding: 10px 10px 8px 12px;
    border-radius: 22px;
  }
  .brand { grid-area: brand; }
  .sub { grid-area: sub; height: 36px; padding: 0 13px 0 11px; font-size: 13px; border-radius: 12px; justify-self: end; }
  .links { grid-area: links; justify-self: center; }
  .link { padding: 0 9px; font-size: 13.5px; font-stretch: 92%; }
  .links { --slot: 20px; }
  .chip { left: 3px; }
}

@media (max-width: 360px) {
  .link { padding: 0 7px; font-size: 13px; font-stretch: 86%; }
  .links { --slot: 19px; }
}
