/* 30 Day Habit v2 — A's layout (cover → contents → spreads), B's voice (one serif,
   mono labels, highlighter, tally). Grid paper sits behind text only, never photos.
   Nav + footer live in nav.css. */

:root {
  --ink: #1F2340;
  --ink-soft: #5A5E78;
  --orange: #E1531B;
  --orange-deep: #C2430F;
  --highlight: rgba(255, 122, 61, .42);
  --paper: #F4F1EA;
  --card: #FFFDF8;
  --rule: rgba(31, 35, 64, .22);
  --grid: rgba(40, 60, 120, .07);

  --serif: "Newsreader", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --measure: 660px;
  --wide: 1180px;
  --gutter: clamp(16px, 4vw, 48px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: hidden; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.6;
  font-optical-sizing: auto;
}
img { max-width: 100%; display: block; }
a { color: inherit; }

.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter); }
.grid-paper {
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* ---------- shared ---------- */
.kicker {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0;
}
.kicker.orange { color: var(--orange); }
mark { background: linear-gradient(transparent 60%, var(--highlight) 60%); color: inherit; }
.btn {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 14px 22px;
  border: 0;
  cursor: pointer;
  transition: background .15s;
}
.btn:hover { background: var(--orange); }
.text-link {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--orange);
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 1.5px;
}
.wave { display: block; width: 100%; height: 60px; color: var(--orange); }

/* tally: 30 ticks per experiment */
.ticks { display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; position: relative; min-width: 0; }
.ticks i { height: 18px; border-left: 2px solid var(--ink); }
.ticks.is-planned i { border-left-color: rgba(31, 35, 64, .18); }
.ticks.is-failed::after {
  content: ""; position: absolute; left: -4px; right: -4px; top: 50%;
  border-top: 2.5px solid var(--orange); transform: rotate(-4deg);
}
.ticks.is-live i { border-left-color: rgba(31, 35, 64, .18); }
.ticks.is-live i.on { border-left-color: var(--orange); border-left-width: 3px; }

/* ---------- homepage: magazine cover (direction A) ---------- */
.mag-cover { position: relative; height: 100vh; min-height: 640px; max-height: 1050px; overflow: hidden; color: var(--paper); }
.mag-cover img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%; }
.mag-cover::after { content: ""; position: absolute; inset: auto 0 0 0; height: 45%; background: linear-gradient(transparent, rgba(10, 12, 30, .45)); pointer-events: none; }
.issue {
  position: absolute; top: 76px; left: var(--gutter); right: var(--gutter); z-index: 2;
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase;
}
.masthead {
  position: absolute; top: 92px; left: 0; right: 0; z-index: 2; margin: 0; text-align: center;
  font-family: "Bodoni Moda", var(--serif); font-weight: 400;
  font-size: clamp(64px, 12.5vw, 210px); line-height: .9; letter-spacing: -.02em;
}
.cover-lines { position: absolute; left: var(--gutter); bottom: 44px; z-index: 2; display: grid; gap: 16px; max-width: 380px; }
.cover-lines a { font-family: "Bodoni Moda", var(--serif); font-size: 23px; line-height: 1.15; text-decoration: none; }
.cover-lines a:hover { color: #FFB088; }
.cover-lines small { display: block; font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; opacity: .85; margin-bottom: 4px; }
.cover-quote {
  position: absolute; right: var(--gutter); bottom: 44px; z-index: 2; max-width: 300px; margin: 0; text-align: right;
  font-style: italic; font-size: 17px; line-height: 1.45;
}

/* live card (sits in the contents column) */
.live {
  display: grid; grid-template-columns: auto 1fr; gap: 16px 26px; align-items: center;
  margin: 34px 0 30px; background: var(--card); border: 1.5px solid var(--ink); padding: 20px 22px;
  box-shadow: 0 14px 30px rgba(20, 24, 50, .1);
}
.live .day { font-size: 58px; line-height: .9; }
.live .day small { display: block; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .1em; line-height: 1.6; }
.live .what { font-size: 19px; line-height: 1.3; }
.live .what .kicker { margin-top: 6px; }
.live .ticks { grid-column: 1 / -1; }

/* ---------- homepage: contents ---------- */
.contents { display: grid; grid-template-columns: .7fr 1.5fr; border-bottom: 1px solid var(--ink); }
.contents .side { padding: 88px var(--gutter) 88px max(var(--gutter), calc((100vw - var(--wide)) / 2 + var(--gutter))); border-right: 1px solid var(--ink); }
.contents h2 { font-weight: 400; font-size: clamp(56px, 6.4vw, 92px); line-height: .9; letter-spacing: -.03em; margin: 12px 0 26px; }
.contents h2 span { color: var(--orange); }
.contents .side p { max-width: 24em; }
.toc { list-style: none; margin: 0; padding: 56px max(var(--gutter), calc((100vw - var(--wide)) / 2 + var(--gutter))) 72px var(--gutter); }
.toc li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 170px 70px;
  gap: 18px;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px dashed var(--rule);
}
.toc .n { font-family: var(--mono); font-size: 12px; color: var(--orange); }
.toc .t { font-size: 23px; line-height: 1.2; }
.toc .t a { text-decoration: underline; text-decoration-color: var(--orange); text-underline-offset: 5px; text-decoration-thickness: 1.5px; }
.toc .t a:hover { color: var(--orange); }
.toc .t small { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); margin-top: 3px; }
.toc .s { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; text-align: right; }
.toc .s.is-failed, .toc .s.is-live { color: var(--orange); }
.toc li.is-planned .t { color: var(--ink-soft); }

/* ---------- homepage: spreads ---------- */
/* Each spread is its own clean half/half block; spreads never touch each other. */
.spreads { display: grid; gap: clamp(72px, 10vw, 140px); padding: clamp(72px, 10vw, 140px) 0; }
.spread { display: grid; grid-template-columns: 1fr 1fr; align-items: center; }
.spread.flip .spread-img { order: 2; }
.spread-img { height: min(82vh, 780px); overflow: hidden; }
.spread-img img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
.spread-txt { padding: 0 clamp(32px, 6vw, 96px); max-width: 640px; }
.spread.flip .spread-txt { justify-self: end; }
.spread-txt h3 { font-weight: 400; font-size: clamp(36px, 3.8vw, 54px); line-height: 1.02; letter-spacing: -.02em; margin: 12px 0 22px; }
.drop::first-letter { float: left; font-size: 92px; line-height: .78; padding: 8px 10px 0 0; color: var(--orange); }
.spread-txt p { margin: 0 0 22px; }

/* ---------- homepage: who ---------- */
.who { padding: 120px 0; }
.who .wrap { display: grid; grid-template-columns: .8fr 1.2fr; gap: 80px; align-items: center; }
.polaroid { position: relative; margin: 0; background: #fff; padding: 14px 14px 52px; transform: rotate(-1.8deg); box-shadow: 0 18px 40px rgba(20, 24, 50, .14); }
.polaroid img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.polaroid figcaption { position: absolute; left: 18px; bottom: 15px; font-family: var(--mono); font-size: 12px; font-weight: 500; }
.tape { position: absolute; top: -14px; left: 50%; width: 120px; height: 30px; transform: translateX(-50%) rotate(-3deg); background: rgba(255, 214, 120, .65); }
.who blockquote { font-size: clamp(26px, 2.6vw, 36px); line-height: 1.3; margin: 14px 0 28px; }
.who p { max-width: 32em; }

/* ---------- signup ---------- */
.signup { padding: 100px 0 40px; }
.signup .wrap { max-width: 760px; }
.signup h2 { font-weight: 400; font-size: clamp(20px, 1.8vw, 24px); line-height: 1.4; margin: 10px 0 24px; max-width: 30em; }
.signup-form { display: flex; gap: 14px; align-items: end; }
.signup-form input {
  flex: 1; min-width: 0;
  font: inherit; font-size: 17px; color: var(--ink);
  background: transparent; border: 0; border-bottom: 1.5px solid var(--ink);
  padding: 10px 2px;
}
.signup-form input:focus { outline: none; border-bottom-color: var(--orange); }
.signup-note { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); margin-top: 14px; min-height: 1.4em; }

/* ---------- experiments page ---------- */
.page-head { padding: 80px 0 30px; }
.page-head h1 { font-weight: 400; font-size: clamp(52px, 7vw, 104px); line-height: .92; letter-spacing: -.03em; margin: 14px 0 18px; }
.page-head p { max-width: 30em; font-size: 22px; }
.exp-page .toc { padding: 20px 0 100px; }

/* ---------- post ---------- */
.post-head { padding: 72px 0 0; }
.post-head .inner { max-width: var(--measure); margin: 0 auto; padding: 0 var(--gutter); box-sizing: content-box; }
.post-head h1 { font-weight: 400; font-size: clamp(40px, 5.4vw, 68px); line-height: 1; letter-spacing: -.02em; margin: 14px 0 22px; }
.post-meta { font-family: var(--mono); font-size: 13px; color: var(--ink-soft); margin: 0; }
.post-meta .readtime { display: block; margin-top: 6px; font-style: italic; }
.part-nav { display: flex; gap: 8px; margin: 26px 0 0; flex-wrap: wrap; }
.part-nav a, .part-nav span {
  font-family: var(--mono); font-size: 13px; min-width: 44px; text-align: center;
  padding: 7px 10px; border: 1.5px solid var(--ink); text-decoration: none; background: var(--card);
}
.part-nav span { background: var(--ink); color: var(--paper); }
.part-nav a:hover { background: var(--highlight); }

.post-hero { max-width: 1100px; margin: 56px auto 72px; padding: 0 var(--gutter); }
.post-hero img { width: 100%; max-height: 720px; object-fit: cover; }
.post-hero.circle img { width: min(460px, 80%); aspect-ratio: 1; border-radius: 50%; margin: 0 auto; }

.prose { max-width: var(--measure); margin: 0 auto; padding: 0 var(--gutter); box-sizing: content-box; }
.prose p { margin: 0 0 1.15em; }
.prose h2 { font-weight: 400; font-size: 34px; line-height: 1.15; letter-spacing: -.01em; margin: 2em 0 .55em; }
.prose h3 { font-weight: 400; font-size: 27px; line-height: 1.25; margin: 2em 0 .5em; padding-top: 1.1em; border-top: 1px dashed var(--rule); }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1.3em; }
.prose li { margin-bottom: .55em; }
.prose li::marker { color: var(--orange); font-family: var(--mono); font-size: .8em; }
.prose a { color: var(--orange); text-underline-offset: 3px; }
.prose .lead { font-size: 30px; line-height: 1.3; margin-bottom: .6em; }
.prose .lead::first-letter { float: left; font-size: 92px; line-height: .78; padding: 8px 10px 0 0; color: var(--orange); }
.prose blockquote { margin: 1.6em 0; padding-left: 22px; border-left: 3px solid var(--orange); font-style: italic; }
.prose blockquote cite { display: block; font-style: normal; font-family: var(--mono); font-size: 13px; margin-top: 8px; color: var(--ink-soft); }
.prose .footnote { font-size: 15px; font-style: italic; color: var(--ink-soft); }
.prose .divider {
  display: flex; align-items: center; gap: 14px; margin: 2.4em 0;
  font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft);
}
.prose .divider::before, .prose .divider::after { content: ""; flex: 1; border-top: 1.5px dotted var(--ink-soft); }
.prose figure { margin: 2.4em 0; }
.prose figure.circle img { width: min(420px, 80%); aspect-ratio: 1; object-fit: cover; border-radius: 50%; margin: 0 auto; }
.prose figure.wide { margin-left: calc(-1 * min(120px, 8vw)); margin-right: calc(-1 * min(120px, 8vw)); }

.up-next { max-width: var(--measure); margin: 72px auto 0; padding: 0 var(--gutter); box-sizing: content-box; }
.up-next a { display: block; text-decoration: none; background: var(--card); border: 1.5px solid var(--ink); padding: 24px 26px; transition: background .15s; }
.up-next a:hover { background: #fff; box-shadow: 0 14px 30px rgba(20, 24, 50, .1); }
.up-next .title { display: block; font-size: 30px; line-height: 1.15; margin-top: 8px; }
.up-next .teaser { display: block; margin-top: 6px; color: var(--ink-soft); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  body { font-size: 18px; }
  .cover-quote { display: none; }
  .issue { top: 70px; }
  .masthead { top: 88px; }
  .cover-lines a { font-size: 20px; }
  .contents { grid-template-columns: 1fr; }
  .contents .side { border-right: 0; border-bottom: 1px solid var(--ink); padding: 64px var(--gutter); }
  .toc { padding: 32px var(--gutter) 56px; }
  .toc li { grid-template-columns: 30px minmax(0, 1fr); gap: 6px 14px; }
  .toc .ticks { grid-column: 2; }
  .toc .s { grid-column: 2; text-align: left; }
  .spread { grid-template-columns: 1fr; }
  .spread.flip .spread-img { order: 0; }
  .spread-img { height: 66vh; }
  .spread-txt { padding: 32px var(--gutter) 0; }
  .who { padding: 72px 0; }
  .who .wrap { grid-template-columns: 1fr; gap: 48px; }
  .polaroid { max-width: 380px; }
  .prose figure.wide { margin-left: 0; margin-right: 0; }
  .signup-form { flex-direction: column; align-items: stretch; }
}

/* ---------- motion (motion.js adds .in / --i; all off for reduced motion) ---------- */
.mag-cover img { animation: cover-in 1.8s cubic-bezier(.2, .7, .2, 1) both; will-change: transform; }
.masthead { animation: rise .9s .25s cubic-bezier(.2, .7, .2, 1) both; }
.issue { animation: fade .8s .6s both; }
.cover-lines a { animation: rise .8s cubic-bezier(.2, .7, .2, 1) both; }
.cover-lines a:nth-child(1) { animation-delay: .7s; }
.cover-lines a:nth-child(2) { animation-delay: .82s; }
.cover-lines a:nth-child(3) { animation-delay: .94s; }
.cover-quote { animation: fade 1s 1.1s both; }
@keyframes cover-in { from { transform: scale(1.08); } to { transform: scale(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.js .reveal { clip-path: inset(0 0 100% 0); transition: clip-path 1.1s cubic-bezier(.65, 0, .2, 1); }
.js .reveal.in { clip-path: inset(0 0 0 0); }
.js .polaroid.reveal { clip-path: none; opacity: 0; transform: rotate(-6deg) translateY(30px); transition: opacity .8s, transform 1s cubic-bezier(.2, .7, .2, 1); }
.js .polaroid.reveal.in { opacity: 1; transform: rotate(-1.8deg); }
.polaroid.in:hover { transform: rotate(0) scale(1.02); }
.spread-img img, .post-hero img { will-change: transform; }

.js .ticks i { opacity: 0; transform: scaleY(.2); transform-origin: bottom; transition: opacity .25s, transform .35s; transition-delay: calc(var(--i, 0) * 22ms); }
.js .ticks.in i { opacity: 1; transform: none; }
.ticks.is-live.in i.today { animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .3; } }

.toc li { transition: background .2s; }
.toc li[data-peek]:hover { background: rgba(255, 253, 248, .7); }
.peek {
  position: fixed; z-index: 30; width: 220px; aspect-ratio: 4 / 5; pointer-events: none;
  background: #fff; padding: 8px 8px 26px; box-shadow: 0 18px 40px rgba(20, 24, 50, .2);
  opacity: 0; transform: translate(-50%, -50%) rotate(3deg) scale(.9); transition: opacity .18s, transform .25s;
}
.peek img { width: 100%; height: 100%; object-fit: cover; }
.peek.on { opacity: 1; transform: translate(-50%, -50%) rotate(3deg) scale(1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal, .js .polaroid.reveal { clip-path: none; opacity: 1; transform: rotate(-1.8deg); }
  .js .spread-img.reveal, .js .post-hero.reveal { transform: none; }
  .js .ticks i { opacity: 1; transform: none; }
}

/* ---------- stronger image motion (v2 of the motion layer) ---------- */
/* cover: slow, endless push-in under the masthead */
.mag-cover img { animation: cover-in 1.8s cubic-bezier(.2, .7, .2, 1) both, drift 24s 1.8s ease-in-out infinite alternate; }
@keyframes drift { from { transform: scale(1); } to { transform: scale(1.09) translate(-1.5%, -1%); } }

/* spreads: photo zooms out from 1.3 to 1 as it reaches the middle of the screen */
.spread-img { position: relative; }
.spread-img img { transition: filter .4s; }
.spread-img:hover img { filter: saturate(1.15) contrast(1.05); }

/* contact-sheet film strip: frames slide past, faster while you scroll, pause on hover */
.film { padding: 56px 0 0; overflow: hidden; border-top: 1px solid var(--ink); }
.film-track { display: flex; gap: 14px; width: max-content; animation: film 70s linear infinite; }
.film:hover .film-track { animation-play-state: paused; }
.film figure { margin: 0; width: 210px; flex: none; background: #fff; padding: 8px 8px 30px; position: relative; box-shadow: 0 10px 24px rgba(20, 24, 50, .1); transition: transform .3s; }
.film figure:nth-child(odd) { transform: rotate(-1.5deg); }
.film figure:nth-child(even) { transform: rotate(1.2deg) translateY(10px); }
.film figure:hover { transform: rotate(0) scale(1.06); z-index: 2; }
.film img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.film figcaption { position: absolute; left: 10px; bottom: 7px; font-family: var(--mono); font-size: 11px; color: var(--ink-soft); }
@keyframes film { to { transform: translateX(-50%); } }
@media (max-width: 900px) { .film figure { width: 150px; } }
@media (prefers-reduced-motion: reduce) { .film-track { animation: none; } }

/* cover legibility: a soft dark wash behind the top line + nav, light shadow on cover type */
.mag-cover::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 34%; z-index: 1; pointer-events: none; background: linear-gradient(rgba(10, 12, 30, .42), transparent); }
.issue, .masthead, .cover-lines, .cover-quote { text-shadow: 0 1px 18px rgba(10, 12, 30, .35); }
.has-cover:not(.scrolled) .site-nav { text-shadow: 0 1px 10px rgba(10, 12, 30, .45); }

/* post header: the experiment's own 30 ticks + outcome, in place of a category label */
.post-tally { display: grid; grid-template-columns: minmax(0, 260px) auto; gap: 14px; align-items: center; margin-top: 20px; }
.post-tally .s { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.who-links { display: flex; gap: 22px; margin-top: 26px; }
.footer-small a { color: inherit; text-underline-offset: 3px; }

/* 404 */
.page-head h1.nf-title { font-size: clamp(34px, 4.4vw, 56px); line-height: 1.05; margin: 12px 0 10px; }
.nf-sub { font-size: 19px; color: var(--ink-soft); margin: 0; }
