/* StudyNest website. Garden notebook: warm paper, forest ink, one serif voice. */

:root {
  color-scheme: light;
  --paper: #f3eee2;
  --paper-deep: #ebe3d1;
  --paper-light: #f9f6ee;
  --ink: #1d3327;
  --ink-soft: #4a5a4f;
  --ink-faint: #7b867d;
  --rule: #d8ceb8;
  --leaf: #2f6b45;
  --leaf-deep: #23543a;
  --marker: #efd98a;
  --late: #b3442d;
  /* Course colours from the app */
  --psy: #2a78d6;
  --eco: #eb6834;
  --chm: #1baf7a;
  --his: #6250d6;

  --serif: "Newsreader", "Iowan Old Style", "Palatino", Georgia, serif;
  --sans: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", "Avenir Next", "Segoe UI Historic", sans-serif;

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1180px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 84px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(17px, 1.05vw + 12px, 19px);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--leaf); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--leaf-deep); }
:focus-visible { outline: 2px solid var(--leaf); outline-offset: 3px; border-radius: 4px; }

.skip {
  position: absolute; left: var(--gutter); top: -100px;
  background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 6px; z-index: 20;
}
.skip:focus { top: 12px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 400; color: var(--ink); margin: 0; }
h1 { font-size: clamp(2.6rem, 5.4vw, 4.9rem); line-height: 1.02; letter-spacing: -.02em; font-variation-settings: "opsz" 72; }
h1 em { font-style: italic; color: var(--leaf); }
h2 { font-size: clamp(2rem, 3.4vw, 3rem); line-height: 1.08; letter-spacing: -.015em; font-variation-settings: "opsz" 60; }
h3 { font-size: clamp(1.45rem, 2vw, 1.85rem); line-height: 1.15; letter-spacing: -.01em; font-variation-settings: "opsz" 36; }
p { margin: 0; }
q { quotes: "“" "”"; font-style: italic; }
kbd {
  font-family: var(--sans); font-size: .82em; font-weight: 500;
  padding: .05em .45em; margin: 0 .08em;
  border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 5px;
  background: var(--paper-light);
}

/* ---------- Masthead ---------- */
.masthead {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px var(--gutter);
  background: var(--paper);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease);
}
.masthead.scrolled { border-bottom-color: var(--rule); }
.wordmark {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--serif); font-size: 1.45rem; font-weight: 500; letter-spacing: -.01em;
  color: var(--ink); text-decoration: none;
}
.masthead nav { display: flex; align-items: center; gap: clamp(14px, 2.5vw, 28px); }
.masthead nav a { color: var(--ink-soft); text-decoration: none; font-size: .95rem; }
.masthead nav a:hover { color: var(--ink); }
.masthead nav .masthead-download { color: var(--leaf); font-weight: 700; }
@media (max-width: 560px) { .masthead nav a:not(.masthead-download) { display: none; } }

/* ---------- Buttons ---------- */
.button {
  display: inline-flex; align-items: baseline; gap: 12px;
  background: var(--ink); color: var(--paper);
  font-family: var(--sans); font-weight: 700; font-size: 1.02rem;
  padding: 15px 26px 14px; border-radius: 999px;
  text-decoration: none;
  transition: background-color .2s var(--ease), transform .2s var(--ease);
}
.button:hover { background: var(--leaf-deep); color: var(--paper); }
.button:active { transform: translateY(1px); }
.button-large { font-size: 1.15rem; padding: 19px 32px 18px; }
.button-meta { font-weight: 400; font-size: .85rem; opacity: .72; white-space: nowrap; }
.fine { color: var(--ink-faint); font-size: .86rem; }
.link-button {
  border: 0; background: none; padding: 0; font: inherit; color: var(--leaf);
  text-decoration: underline; text-underline-offset: .18em; cursor: pointer;
}

/* ---------- Hero ---------- */
.hero {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(40px, 7vw, 96px) var(--gutter) clamp(56px, 8vw, 120px);
  display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  gap: clamp(36px, 6vw, 88px); align-items: start;
}
.kicker {
  font-size: .9rem; font-weight: 500; letter-spacing: .02em; color: var(--ink-soft);
  margin-bottom: 22px;
}
.lede { margin-top: 26px; max-width: 34em; color: var(--ink-soft); font-size: 1.08em; }
.hero-actions { margin-top: 34px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.promise {
  margin-top: 30px; padding-top: 16px; border-top: 1px solid var(--rule);
  font-family: var(--serif); font-style: italic; font-size: 1.12rem; color: var(--ink-soft);
  max-width: 26em;
}

/* Capture demo */
.hero-demo { position: relative; padding-top: clamp(0px, 3vw, 46px); }
.demo-label { font-size: .86rem; color: var(--ink-faint); margin: 0 0 10px 4px; }
.capture {
  position: relative;
  background: var(--paper-light);
  border: 1px solid var(--rule);
  border-radius: 18px;
  padding: 18px 18px 14px 56px;
  box-shadow: 0 1px 0 rgba(29, 51, 39, .04), 0 18px 40px -26px rgba(29, 51, 39, .45);
  transform-origin: 50% 0;
}
.capture.pulse { animation: settle .45s var(--ease); }
@keyframes settle { 0% { transform: scale(.985); } 100% { transform: scale(1); } }
.capture-leaf { position: absolute; left: 18px; top: 20px; }
.capture input {
  width: 100%; border: 0; background: transparent; outline: none;
  font-family: var(--sans); font-size: 1.12rem; color: var(--ink); padding: 2px 0 10px;
}
.capture input::placeholder { color: var(--ink-faint); }
.capture-kinds { display: inline-flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--paper-deep); }
.capture-kinds button {
  border: 0; background: transparent; color: var(--ink-soft);
  font: 500 .82rem/1 var(--sans); padding: 7px 11px; border-radius: 7px; cursor: pointer;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.capture-kinds button[aria-checked="true"] { background: var(--ink); color: var(--paper); }
.capture-preview { min-height: 1.5em; margin-top: 10px; font-size: .86rem; color: var(--ink-soft); }
.capture-preview .chip-course { display: inline-flex; align-items: center; gap: 5px; }
.capture-preview .chip-course::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.capture-preview .urgent { color: var(--late); font-weight: 700; }
.capture-preview .sep { color: var(--rule); margin: 0 6px; }

.demo-list { margin: 18px 4px 0; }
.demo-list-title { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 6px; }
.demo-list ul { list-style: none; margin: 0; padding: 0; }
.demo-list li {
  display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 10px; align-items: baseline;
  padding: 9px 0; border-top: 1px solid var(--rule); font-size: .95rem;
}
.demo-list li .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--ink-faint)); transform: translateY(-1px); }
.demo-list li .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demo-list li .d { color: var(--ink-faint); font-size: .86rem; }
.demo-list li .d.late { color: var(--late); }
.demo-list li .kind { font-size: .72rem; font-weight: 700; color: var(--ink-soft); background: var(--paper-deep); border-radius: 5px; padding: 1px 6px; margin-left: 6px; }
.demo-list li.new { animation: arrive .55s var(--ease); background: linear-gradient(var(--marker), var(--marker)) no-repeat; background-size: 100% 100%; animation-fill-mode: both; }
@keyframes arrive {
  0% { opacity: 0; transform: translateY(-10px); background-size: 100% 100%; }
  60% { opacity: 1; transform: none; }
  100% { background-size: 0% 100%; }
}

/* Growing grove */
.grove { position: relative; height: clamp(170px, 18vw, 230px); margin-top: 22px; }
.tree { position: absolute; bottom: 0; left: var(--x, 0); width: calc(min(200px, 42vw) * var(--s, 1)); aspect-ratio: 200 / 220; }
.tree img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; transition: opacity .6s var(--ease);
}
.tree img.on { opacity: 1; }

/* ---------- Home showcase ---------- */
.week { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter) clamp(72px, 9vw, 140px); }
.week-head {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(20px, 5vw, 72px); align-items: end; margin-bottom: clamp(28px, 4vw, 48px);
  border-top: 1px solid var(--rule); padding-top: clamp(28px, 4vw, 48px);
}
.week-head p { color: var(--ink-soft); max-width: 32em; }

.window {
  margin: 0;
  border-radius: 14px; overflow: hidden;
  background: var(--paper-light);
  box-shadow: 0 0 0 1px rgba(29, 51, 39, .1), 0 30px 60px -38px rgba(29, 51, 39, .55);
}
.window img { display: block; width: 100%; height: auto; clip-path: inset(2px round 18px); }
.zoom { display: block; cursor: zoom-in; border-radius: inherit; }
.zoom:focus-visible { outline: 3px solid var(--leaf); outline-offset: 4px; }
.window { transition: box-shadow .3s var(--ease), transform .3s var(--ease); }
.window:has(.zoom:hover) { box-shadow: 0 0 0 1px rgba(29, 51, 39, .16), 0 34px 70px -36px rgba(29, 51, 39, .6); transform: translateY(-2px); }

/* ---------- Enlarged screenshot ---------- */
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: clamp(12px, 4vw, 48px);
  border: 0; background: transparent; color: var(--paper);
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.lightbox[open] { display: flex; animation: lightbox-in .25s var(--ease); }
.lightbox::backdrop { background: rgba(20, 30, 24, .82); }
.lightbox img {
  max-width: min(100%, 1600px); max-height: calc(100dvh - 120px); width: auto; height: auto;
  border-radius: 14px; clip-path: inset(3px round 16px); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .7);
  cursor: zoom-out;
}
.lightbox-caption { margin: 0; max-width: 60ch; text-align: center; font-size: .95rem; color: #e9e3d4; }
.lightbox-close {
  position: absolute; top: clamp(10px, 2vw, 20px); right: clamp(10px, 2vw, 20px);
  font: 600 .9rem/1 var(--sans); color: var(--ink); background: var(--paper);
  border: 0; border-radius: 999px; padding: 10px 16px; cursor: pointer;
}
@keyframes lightbox-in { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Tour ---------- */
.tour { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.entry {
  display: grid; grid-template-columns: minmax(0, .78fr) minmax(0, 1.22fr);
  gap: clamp(28px, 5vw, 72px); align-items: center;
  padding: clamp(40px, 6vw, 84px) 0; border-top: 1px solid var(--rule);
}
.entry-flip { grid-template-columns: minmax(0, 1.22fr) minmax(0, .78fr); }
.entry-flip .entry-text { order: 2; }
.entry-text p:not(.num) { color: var(--ink-soft); margin-top: 16px; max-width: 30em; }
.num {
  font-family: var(--serif); font-style: italic; font-size: 1.05rem; color: var(--leaf);
  margin-bottom: 10px; font-variant-numeric: oldstyle-nums;
}

/* ---------- Download ---------- */
.download { padding: clamp(72px, 10vw, 150px) var(--gutter) clamp(40px, 6vw, 80px); }
.download-card {
  max-width: 760px; margin: 0 auto; text-align: left;
  border-top: 2px solid var(--ink); padding-top: clamp(28px, 4vw, 44px);
}
.price { margin: 18px 0 30px; font-size: 1.12rem; color: var(--ink-soft); max-width: 30em; }
.price::first-line { color: var(--ink); }
.download-card .fine { margin-top: 16px; }
.not-mac { margin-top: 18px; padding: 14px 16px; background: var(--paper-deep); border-radius: 10px; font-size: .95rem; }

/* ---------- Install ---------- */
.install { max-width: var(--max); margin: 0 auto; padding: clamp(40px, 6vw, 80px) var(--gutter) clamp(72px, 9vw, 130px); }
.install-intro { color: var(--ink-soft); margin-top: 14px; max-width: 34em; }
.steps {
  list-style: none; margin: clamp(30px, 4vw, 48px) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(20px, 3vw, 36px);
  counter-reset: step;
}
.steps li { counter-increment: step; position: relative; padding-top: 52px; }
.steps li::before {
  content: counter(step);
  position: absolute; top: 0; left: 0;
  font-family: var(--serif); font-size: 2.4rem; line-height: 1; color: var(--leaf);
}
.steps h3 { font-size: 1.3rem; }
.steps p { color: var(--ink-soft); font-size: .95rem; margin-top: 8px; }
.mock-dialog {
  margin-top: 16px; padding: 14px; border-radius: 12px;
  background: var(--paper-light); border: 1px solid var(--rule);
  font-size: .82rem; line-height: 1.4;
}
.mock-dialog p { margin-bottom: 10px; }
.mock-small { color: var(--ink-soft); }
.mock-btn {
  display: inline-block; margin-right: 6px; padding: 4px 11px; border-radius: 6px;
  background: var(--paper-deep); color: var(--ink-soft); font-weight: 500;
}
.mock-btn-on { background: var(--leaf); color: var(--paper-light); box-shadow: 0 0 0 3px color-mix(in srgb, var(--marker) 80%, transparent); }

/* ---------- Note ---------- */
.note {
  max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter) clamp(72px, 9vw, 130px);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: clamp(20px, 5vw, 64px);
}
.note-paper {
  max-width: 640px; padding: clamp(28px, 4vw, 48px);
  background: var(--paper-light);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(1.7em - 1px), rgba(42, 120, 214, .13) calc(1.7em - 1px), rgba(42, 120, 214, .13) 1.7em);
  background-position: 0 2.6em;
  border-left: 2px solid rgba(179, 68, 45, .35);
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(29, 51, 39, .05), 0 22px 40px -32px rgba(29, 51, 39, .5);
  font-family: var(--serif); font-size: 1.16rem; line-height: 1.7em;
  transform: rotate(-.6deg);
}
.note-paper p + p { margin-top: 1.7em; }
.note-kicker { font-family: var(--sans); font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
.signature { font-style: italic; font-size: 1.5rem; color: var(--leaf); }
.note-tree { position: relative; width: clamp(140px, 16vw, 220px); aspect-ratio: 1; }
.note-tree .tree { position: absolute; inset: 0; width: 100%; left: 0; bottom: 0; }

/* ---------- Footer ---------- */
.footer {
  max-width: var(--max); margin: 0 auto; padding: 28px var(--gutter) 44px;
  border-top: 1px solid var(--rule);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  font-size: .88rem; color: var(--ink-faint);
}
.wordmark-small { font-family: var(--serif); font-size: 1.05rem; color: var(--ink); }

/* ---------- Reveal on scroll ---------- */
[data-reveal] { transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js [data-reveal]:not(.seen) { opacity: 0; transform: translateY(18px); }
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal]:not(.seen) { opacity: 1; transform: none; }
  .tree img, [data-reveal], .capture-kinds button, .window { transition: none; }
  .lightbox[open] { animation: none; }
  .demo-list li.new, .capture.pulse { animation: none; }
}

/* ---------- Smaller screens ---------- */
@media (max-width: 920px) {
  .hero { grid-template-columns: 1fr; }
  .hero-demo { padding-top: 0; max-width: 560px; }
  .week-head { grid-template-columns: 1fr; }
  .entry, .entry-flip { grid-template-columns: 1fr; }
  .entry-flip .entry-text { order: 0; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .note { grid-template-columns: 1fr; }
  .note-tree { justify-self: end; margin-top: -40px; }
}
@media (max-width: 560px) {
  .steps { grid-template-columns: 1fr; }
  .capture { padding-left: 48px; }
  .capture-leaf { left: 14px; }
  .window { border-radius: 10px; }
  .window img { clip-path: inset(1px round 9px); }
  .note-paper { transform: none; }
  .button-large { flex-direction: column; align-items: flex-start; gap: 2px; padding: 16px 28px; }
}
