/* CookSync project site — shared styles for every page and document.
 *
 * The palette, type and shapes below are taken from the Android app rather than
 * invented for the web, so the site and the product read as one thing:
 *
 *   - Colours are the app's own tokens (cook-sync-client/.../values/colors.xml):
 *     the warm cream ground, terracotta accent and olive secondary.
 *   - Caprasimo sets headings and Figtree sets body text, matching
 *     CookSync.Heading.H2 and the app's layouts.
 *   - Pill buttons and inputs (27dp on a 54dp control), 16dp cards and 32dp
 *     large surfaces mirror the app's drawables and bottom sheets.
 */

/* The app's two typefaces, self-hosted so the site pulls nothing from a third
 * party at runtime: no Google Fonts request, no render-blocking round trip, and
 * the page looks right offline. Both are SIL Open Font License 1.1 — see
 * assets/fonts/OFL.txt. Figtree ships as one variable file per subset covering
 * the whole 300-900 range, which is why there is no file per weight.
 */

@font-face {
  font-family: 'Caprasimo';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/caprasimo-400-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Caprasimo';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/caprasimo-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('fonts/figtree-var-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('fonts/figtree-var-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* color_bg / color_surface / color_text */
  --bg: #F5EAD8;
  --surface: #EBDDC5;
  --text: #201E1D;
  --text-muted: #605B55;           /* color_text at the app's 0.7 alpha, flattened */

  /* color_accent and its scale */
  --accent: #C67139;
  --accent-hover: #B2622D;         /* color_accent_600 */
  --accent-deep: #8C491A;          /* color_accent_700 */
  --accent-tint: #FFF2EB;          /* color_accent_100 */
  --accent-800: #643312;           /* color_accent_800 — button hover */
  --on-accent: #F5EAD8;            /* the app puts color_bg on accent buttons */

  /* color_accent_2 — the olive secondary */
  --olive: #7A8A5E;
  --olive-deep: #56633F;           /* color_accent_2_700 */

  --border: rgba(32, 30, 29, .16); /* color_divider */
  --border-strong: rgba(32, 30, 29, .28);
  --code-bg: #FFF2EB;
  --shadow: 0 1px 2px rgba(64, 35, 16, .06), 0 10px 30px rgba(64, 35, 16, .07);

  --radius-card: 16px;             /* bg_uses_card */
  --radius-lg: 32px;               /* ShapeAppearance.CookSync.Dialog / BottomSheet */
  --radius-pill: 999px;            /* bg_input, CookSync.Button.* */

  --font-display: "Caprasimo", Georgia, "Times New Roman", serif;
  --font-body: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --measure: 46rem;
  --header-h: 60px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

::selection { background: var(--accent); color: var(--on-accent); }

/* ---------------------------------------------------------------- header -- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

@supports (backdrop-filter: blur(1px)) {
  .site-header {
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: saturate(160%) blur(12px);
  }
}

.site-header__inner {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 20px;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.12rem;
  color: var(--text);
  padding: 10px 0;
  flex: 0 0 auto;
}
.brand:hover { text-decoration: none; color: var(--accent-deep); }
.brand img { width: 28px; height: 28px; border-radius: 8px; }

/* One row that scrolls sideways: a wrapping nav turns the sticky header into a
   band tall enough to eat a third of a phone screen on every scroll. */
.site-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(to right, transparent 0, #000 12px);
}
.site-nav::-webkit-scrollbar { display: none; }

.site-nav a {
  flex: 0 0 auto;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: .93rem;
  font-weight: 500;
  padding: 19px 0 17px;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--text); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--accent-deep); border-bottom-color: var(--accent); }

@media (min-width: 48rem) {
  .site-nav { mask-image: none; }
}

/* ---------------------------------------------------------------- footer -- */

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 80px;
  padding: 30px 20px 52px;
  color: var(--text-muted);
  font-size: .88rem;
  text-align: center;
}
.site-footer nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 18px; margin-bottom: 10px; }
.site-footer p { margin: 0; }

/* ------------------------------------------------------------ doc layout -- */

.doc {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 48px;
}

@media (min-width: 62rem) {
  .doc { grid-template-columns: minmax(0, 1fr) 15rem; align-items: start; }
}

.doc__body { min-width: 0; max-width: var(--measure); padding-top: 44px; }

.doc__header { margin-bottom: 40px; padding-bottom: 30px; border-bottom: 1px solid var(--border); }

.doc__eyebrow {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent-deep);
  background: var(--accent-tint);
  border: 1px solid var(--border);
  padding: 5px 13px;
  border-radius: var(--radius-pill);
  margin-bottom: 16px;
}

.doc__title {
  font-family: var(--font-display);
  font-size: 2.35rem;
  font-weight: 400;
  line-height: 1.15;
  margin: 0 0 .3em;
}
.doc__summary { color: var(--text-muted); margin: 0; font-size: 1.04rem; }

/* --------------------------------------------------------- doc typography -- */

.prose h1, .prose h2, .prose h3, .prose h4 { line-height: 1.3; scroll-margin-top: calc(var(--header-h) + 18px); }

/* Caprasimo carries the section headings, matching CookSync.Heading.H2 in the
   app; h3 and below stay in Figtree so a long document remains scannable. */
.prose h1, .prose h2 { font-family: var(--font-display); font-weight: 400; }
.prose h1 { font-size: 1.85rem; margin: 2.4em 0 .6em; }
.prose h2 {
  font-size: 1.45rem;
  margin: 2.6em 0 .7em;
  padding-bottom: .32em;
  border-bottom: 1px solid var(--border);
}
.prose h3 { font-size: 1.1rem; font-weight: 700; margin: 2em 0 .5em; }
.prose h4 { font-size: 1rem; font-weight: 600; margin: 1.8em 0 .4em; color: var(--text-muted); }
.prose > h1:first-child, .prose > h2:first-child { margin-top: 0; }

.prose p, .prose ul, .prose ol { margin: 0 0 1.15em; }
.prose li { margin: .35em 0; }
.prose li > ul, .prose li > ol { margin: .35em 0; }
.prose li::marker { color: var(--accent); }

.prose strong { font-weight: 700; }

.prose hr { border: 0; border-top: 1px solid var(--border); margin: 3em 0; }

/* The app draws a note as a dashed olive card (bg_note_dashed); blockquotes in
   these documents are notes, so they get the same treatment. */
.prose blockquote {
  margin: 1.7em 0;
  padding: 16px 20px;
  border: 1.5px dashed var(--olive);
  border-radius: var(--radius-card);
  background: transparent;
  color: var(--text-muted);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose blockquote strong { color: var(--olive-deep); }

.prose code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: .87em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: .1em .4em;
  border-radius: 6px;
}
.prose pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px 18px;
  overflow-x: auto;
  line-height: 1.55;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: .85em; }

/* Tables carry most of the detail in these documents, so they get real care. */
.prose .table-scroll {
  overflow-x: auto;
  margin: 0 0 1.6em;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}
.prose table { border-collapse: collapse; width: 100%; font-size: .93rem; }
.prose thead th {
  background: var(--surface);
  text-align: left;
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}
.prose th, .prose td {
  padding: 11px 15px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
}
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody tr:hover { background: var(--accent-tint); }

.heading-anchor {
  margin-left: .35em;
  color: var(--accent);
  opacity: 0;
  font-family: var(--font-body);
  font-weight: 400;
  text-decoration: none;
}
h1:hover > .heading-anchor,
h2:hover > .heading-anchor,
h3:hover > .heading-anchor { opacity: .6; }
.heading-anchor:hover { opacity: 1 !important; text-decoration: none; }

/* --------------------------------------------------------------- doc TOC -- */

.toc { display: none; }

@media (min-width: 62rem) {
  .toc {
    display: block;
    position: sticky;
    top: calc(var(--header-h) + 18px);
    padding-top: 44px;
    max-height: calc(100vh - var(--header-h) - 36px);
    overflow-y: auto;
    font-size: .875rem;
  }
  .toc__label {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 12px;
  }
  .toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
  .toc li { margin: 0; }
  .toc a {
    display: block;
    padding: 6px 0 6px 14px;
    margin-left: -1px;
    border-left: 2px solid transparent;
    color: var(--text-muted);
    line-height: 1.4;
  }
  .toc a:hover { color: var(--text); text-decoration: none; }
  .toc a.is-active { color: var(--accent-deep); border-left-color: var(--accent); font-weight: 600; }
}

/* -------------------------------------------------- screenshots & figures -- */

/* The mockups carry a white rounded corner baked into the JPEG. Clipping the
   image to the frame's own radius (41px on a 395px-wide source, expressed as a
   percentage so it holds at any rendered size) drops those corners instead of
   showing white notches against the cream ground. */
.shot-frame,
.prose .shots img,
.shots img {
  border-radius: 11% / 5.2%;
  display: block;
}

.prose .shots,
.shots {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0 0 1.9em;
  padding: 0;
}
.prose .shots img { width: 224px; height: auto; max-width: calc(50% - 8px); }

.prose .diagram {
  margin: 1.9em 0;
  text-align: center;
}
.prose .diagram a { display: block; }
.prose .diagram a:hover img { border-color: var(--accent); }
.prose .diagram img {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 10px;
}
.prose .diagram em {
  display: block;
  font-style: normal;
  font-size: .86rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin-top: .7em;
}

/* Homepage strip: scrolls sideways on a phone rather than wrapping into a wall. */
.gallery {
  margin: 2.8em 0 0;
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.gallery::-webkit-scrollbar { display: none; }

/* Fade the trailing edge so it reads as "there is more to the right". */
@media (max-width: 52rem) {
  .gallery { mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
}
.gallery img {
  flex: 0 0 auto;
  width: 186px;
  height: auto;
  border-radius: 11% / 5.2%;
}
.gallery__caption {
  color: var(--text-muted);
  font-size: .87rem;
  margin: 1em 0 0;
}

/* -------------------------------------------------------------- homepage -- */

.home { max-width: 46rem; margin: 0 auto; padding: 68px 20px 0; text-align: center; }
.home__logo { width: 92px; height: 92px; border-radius: 22px; }
.home__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2.7rem;
  margin: .4em 0 .18em;
}
.home__tagline { color: var(--text-muted); font-size: 1.08rem; margin: 0 auto 2.8em; max-width: 34rem; }

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 34px 28px;
  text-align: center;
}
.card h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.5rem; margin: 0 0 .25em; }
.card > p { color: var(--text-muted); margin: 0 0 1.3em; }

/* The QR sits on a white card so it stays scannable. */
.card img.qr {
  width: 156px;
  height: 156px;
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  border: 1px solid var(--border);
}

/* The app's own button is color_bg on color_accent, which is only 3.0:1 — fine
   for a 54dp tap target you are already looking at, thin for a web page's main
   call to action. Stepping one stop down the same ramp to color_accent_700 keeps
   it inside the app's palette and reaches 5.7:1. */
.btn {
  display: inline-block;
  background: var(--accent-deep);
  color: var(--on-accent);
  padding: 14px 32px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 1rem;
  margin-top: 20px;
  border: 0;
}
.btn:hover { background: var(--accent-800); color: var(--on-accent); text-decoration: none; }

.note { color: var(--text-muted); font-size: .87rem; margin: 18px 0 0; line-height: 1.55; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 16px;
  margin-top: 2.8em;
  text-align: left;
}
.tile {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 22px 24px;
  color: inherit;
  transition: border-color .15s ease, transform .15s ease;
}
.tile:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.tile h3 {
  font-family: var(--font-display);
  font-weight: 400;
  margin: 0 0 .35em;
  font-size: 1.12rem;
  color: var(--accent-deep);
}
.tile p { margin: 0; color: var(--text-muted); font-size: .9rem; line-height: 1.5; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tile { transition: none; }
  .tile:hover { transform: none; }
}

@media (max-width: 40rem) {
  .home { padding-top: 46px; }
  .home__title { font-size: 2.1rem; }
  .doc__title { font-size: 1.85rem; }
  .card { padding: 28px 20px; border-radius: 26px; }
}
