/* ateeshayjain.github.io — one stylesheet for the whole site.
 *
 * Theming is by custom properties only:
 *   :root                    Tidepool (home, Apps, 404), copied from
 *                            Templates/Nature-Palettes/Tidepool/tokens.css
 *   [data-theme="tattvam"]   Tattvam brand roles (plum on ivory)
 *   [data-theme="aangan"]    Aangan brand roles (terracotta on cream)
 * Each block has a prefers-color-scheme: dark counterpart.
 * tests/check_site.py parses these blocks and fails below WCAG AA 4.5:1.
 */

/* ------------------------------------------------------------------ fonts
 * Fraunces and DM Sans, self-hosted variable woff2 (SIL OFL 1.1, see
 * assets/fonts/LICENSE.txt). Weights 400-600 only. Devanagari (तत्त्वम्, आँगन)
 * is not in these files and falls back to the system font, as intended.
 * The latin files are preloaded by every page; latin-ext (which carries ₹)
 * loads only when a page uses one of its characters.
 */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/fraunces-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: "Fraunces";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/fraunces-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/dm-sans-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: "DM Sans";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/dm-sans-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ------------------------------------------------------- Tidepool tokens */
:root {
  --bg: #F5F3EE;
  --surface: #FFFFFF;
  --surface-alt: #E6EDF3;
  --ink: #1C1A18;
  --ink-muted: #5C5550;
  --border: #D9D4CB;
  --primary: #4A3226;
  --on-primary: #F5F3EE;
  --accent: #3F6A8F;
  --on-accent: #FFFFFF;
  --highlight: #7A2430;
  --status-success: #3F7A3A;
  --status-warning: #8F5C0E;
  --status-danger: #A3262F;
  --status-info: #2F5F86;
  --swatch-basalt: #4A3226;
  --swatch-cocoa-rock: #2E1F18;
  --swatch-foam: #F5F3EE;
  --swatch-sea-glass: #8FAECB;
  --swatch-mist: #CFDCE8;
  --swatch-shale: #7C8C9A;
  --swatch-ink: #1C1A18;
  --swatch-oxblood: #7A2430;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --radius-sm: 10px;
  --radius-md: 20px;
  --radius-lg: 30px;
  --radius-pill: 999px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.06), 0 6px 20px rgba(0,0,0,0.06);

  /* Site roles built on the tokens. */
  --focus: var(--accent);
  --measure: 62ch;
  --section-space: clamp(56px, 9vw, 112px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17130F;
    --surface: #231C17;
    --surface-alt: #2E1F18;
    --ink: #F5F3EE;
    --ink-muted: #B5ADA3;
    --border: #3D332C;
    --primary: #A9C3DC;
    --on-primary: #17130F;
    --accent: #D9B8A0;
    --on-accent: #17130F;
    --highlight: #C9606B;
    --status-success: #8FCB7E;
    --status-warning: #E8B45A;
    --status-danger: #F0908C;
    --status-info: #9CC2E2;
    --shadow-card: 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.35);
  }
}

/* ----------------------------------------------------------- app themes */
[data-theme="tattvam"] {
  --bg: #F7F4F5;
  --surface: #FFFFFF;
  --surface-alt: #ECE4E8;
  --ink: #2A1820;
  --ink-muted: #6B5560;
  --primary: #5A2E42;
  --on-primary: #FFFFFF;
  --border: #ECE4E8;
  --accent: #8A5A6E;      /* Tattvam primaryLight: focus ring and tints */
  --highlight: #8A5A6E;   /* the wordmark's hairline rule */
}
[data-theme="aangan"] {
  --bg: #FBF7F2;
  --surface: #FFFFFF;
  --surface-alt: #F3EAE0;
  --ink: #2B2420;
  --ink-muted: #6B5E55;
  --primary: #A8553A;     /* 5.22:1 with white, so the #9A4C33 fallback is not needed */
  --on-primary: #FFFFFF;
  --border: #E8DFD5;
  --accent: #A8553A;
  --highlight: #A8553A;
}
@media (prefers-color-scheme: dark) {
  [data-theme="tattvam"] {
    --bg: #1E1218;
    --surface: #2A1820;
    --surface-alt: #34202A;
    --ink: #F7F4F5;
    --ink-muted: #C9B5BF;
    --primary: #C99AAE;
    --on-primary: #1E1218;
    --border: #3F1F2E;
    --accent: #C99AAE;
    --highlight: #C99AAE;
  }
  [data-theme="aangan"] {
    --bg: #1A1411;
    --surface: #251C17;
    --surface-alt: #2E231D;
    --ink: #F6EFE8;
    --ink-muted: #BBAA9C;
    --primary: #E09A7E;
    --on-primary: #1A1411;
    --border: #3A2C24;
    --accent: #E09A7E;
    --highlight: #E09A7E;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--space-6);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;        /* 17px */
  line-height: 1.6;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

img, svg { display: block; max-width: 100%; height: auto; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 1.35rem + 2.9vw, 3rem); }          /* 32–48px */
h2 { font-size: clamp(1.5rem, 1.25rem + 1.1vw, 2rem); }         /* 24–32px */
h3 { font-size: 1.1875rem; line-height: 1.3; font-weight: 600; } /* 19px */

p, ul, ol, dl { margin: 0; }
p + p { margin-top: var(--space-4); }
p, li, dd { text-wrap: pretty; }

a {
  color: var(--primary);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

strong { font-weight: 600; }

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 10;
  padding: var(--space-2) var(--space-4);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-sm);
}
.skip-link:focus { top: var(--space-4); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------- layout */
.wrap {
  width: 100%;
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: var(--space-4);     /* the 16px phone gutter */
}
@media (min-width: 720px) {
  .wrap { padding-inline: var(--space-8); }
}

main { display: block; }

.section { padding-block: var(--section-space) 0; }
.section:last-child { padding-bottom: var(--section-space); }
.section > .wrap > h2 { margin-bottom: var(--space-6); }
.section-intro {
  max-width: var(--measure);
  color: var(--ink-muted);
  margin: calc(-1 * var(--space-3)) 0 var(--space-8);
}
.prose { max-width: var(--measure); }
.prose h2 { margin: var(--space-12) 0 var(--space-4); }
.prose h2:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li + li { margin-top: var(--space-2); }
.prose p + ul, .prose ul + p { margin-top: var(--space-4); }

/* --------------------------------------------------------------- header */
.site-header { padding-block: var(--space-6); }
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3) var(--space-6);
}
.wordmark {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.005em;
}
.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-6);
  list-style: none;
  padding: 0;
}
.site-nav a {
  display: inline-block;
  padding-block: var(--space-2);       /* keeps the tap target near 44px */
  color: var(--ink-muted);
  text-decoration: none;
}
.site-nav a:hover { color: var(--ink); text-decoration: underline; }
.site-nav a[aria-current="page"] { color: var(--ink); }

/* ----------------------------------------------------------------- hero */
.hero { padding-block: clamp(48px, 12vw, 136px) 0; }
.eyebrow {
  font-size: 0.9375rem;
  color: var(--ink-muted);
  margin-bottom: var(--space-4);
}
.hero h1 { font-size: clamp(2.5rem, 1.5rem + 4.6vw, 4.25rem); max-width: 14ch; }
.hero .lede {
  max-width: 38ch;
  margin-top: var(--space-6);
  font-size: clamp(1.125rem, 1.05rem + 0.4vw, 1.3125rem);
  line-height: 1.5;
  color: var(--ink-muted);
}
.rule {
  display: block;
  width: 72px;
  height: 0;
  margin: var(--space-8) 0 0;
  border: 0;
  border-top: 1px solid var(--highlight);
}

/* ------------------------------------------------------------ app cards */
.app-list {
  display: grid;
  gap: var(--space-4);
  list-style: none;
  padding: 0;
}
@media (min-width: 760px) {
  .app-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6); }
}
.app-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: var(--space-4) var(--space-6);
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.app-card img {
  width: 72px;
  height: 72px;
  border-radius: 16px;                 /* iOS icon corner at this size */
  box-shadow: 0 0 0 1px rgba(0,0,0,0.06);
}
.app-card :is(h2, h3) { font-family: var(--font-display); font-weight: 500; font-size: 1.3125rem; }
.app-card :is(h2, h3) a { color: var(--ink); text-decoration: none; }
.app-card :is(h2, h3) a:hover { text-decoration: underline; }
.app-card p { margin-top: var(--space-2); color: var(--ink-muted); }
.app-card .card-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-6);
}
/* On the home page the whole card is one link. */
.app-card.is-link h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
}
.app-card.is-link:hover { border-color: var(--ink-muted); }
.app-card.is-link:focus-within { outline: 2px solid var(--focus); outline-offset: 3px; }
.app-card.is-link h3 a:focus-visible { outline: none; }

/* -------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: var(--space-3) var(--space-6);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { text-decoration: underline; }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--border); }
.btn-quiet:hover { border-color: var(--ink-muted); }
.btn svg { width: 20px; height: 20px; flex: none; }
/* A button whose link is not known yet: drawn, but not a link. */
.btn[aria-disabled="true"] { cursor: default; opacity: 0.75; text-decoration: none; }

/* ------------------------------------------------------------- app hero */
.app-hero { padding-block: clamp(40px, 9vw, 104px) 0; }
.app-hero .wrap {
  display: grid;
  gap: var(--space-6) var(--space-12);
  align-items: center;
}
@media (min-width: 720px) {
  .app-hero .wrap { grid-template-columns: auto 1fr; }
}
.app-icon {
  width: 112px;
  height: 112px;
  border-radius: 25px;                 /* iOS icon corner at this size */
  box-shadow: 0 0 0 1px rgba(0,0,0,0.06), var(--shadow-card);
}
@media (min-width: 720px) {
  .app-icon { width: 168px; height: 168px; border-radius: 37px; }
}
.app-hero h1 { max-width: 18ch; }
.app-hero .subtitle {
  margin-top: var(--space-3);
  font-family: var(--font-display);
  font-size: clamp(1.1875rem, 1.1rem + 0.5vw, 1.4375rem);
  line-height: 1.35;
  color: var(--ink-muted);
}
.app-hero .meta { margin-top: var(--space-3); font-size: 0.9375rem; color: var(--ink-muted); }
.app-hero .rule { margin-top: var(--space-6); }
.app-hero .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-4);
  margin-top: var(--space-6);
}
.app-intro {
  max-width: var(--measure);
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  line-height: 1.55;
}

/* ---------------------------------------------------------- screenshots */
.shots {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  padding-bottom: var(--space-4);
  margin-inline: calc(-1 * var(--space-4));
  padding-inline: var(--space-4);
  scroll-padding-inline: var(--space-4);
}
.shots img {
  flex: none;
  width: min(68vw, 260px);
  scroll-snap-align: start;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

/* ------------------------------------------------------------- features */
.features {
  display: grid;
  gap: var(--space-8) var(--space-12);
  list-style: none;
  padding: 0;
}
@media (min-width: 640px) {
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .features { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.feature {
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}
.feature h3 { margin-bottom: var(--space-2); }
.feature p { color: var(--ink-muted); }

/* ------------------------------------------------------ private by design
 * The one filled block on an app page: the brand colour, edge to edge
 * inside the wrap, so the privacy summary is the thing you remember. */
.privacy-panel {
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--radius-md);
  padding: clamp(28px, 6vw, 64px) clamp(20px, 5vw, 64px);
  --focus: var(--on-primary);
}
.privacy-panel h2 { color: var(--on-primary); margin-bottom: var(--space-3); }
.privacy-panel > p { max-width: var(--measure); }
.privacy-panel a { color: var(--on-primary); }
.privacy-facts {
  display: grid;
  margin-top: var(--space-8);
}
.privacy-facts > div {
  padding-block: var(--space-4);
  border-top: 1px solid color-mix(in srgb, var(--on-primary) 28%, transparent);
}
.privacy-facts dt { font-weight: 600; }
.privacy-facts dd { margin: var(--space-1) 0 0; max-width: var(--measure); }
@media (min-width: 760px) {
  .privacy-facts > div {
    display: grid;
    grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
    gap: var(--space-8);
  }
  .privacy-facts dd { margin: 0; }
}

/* ------------------------------------------------------------ documents */
.docs {
  display: grid;
  gap: var(--space-4);
  list-style: none;
  padding: 0;
}
@media (min-width: 640px) {
  .docs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.doc {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--ink);
  text-decoration: none;
}
.doc:hover { border-color: var(--primary); }
.doc .doc-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.25;
  color: var(--primary);
}
.doc:hover .doc-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.doc .doc-line { margin-top: var(--space-2); color: var(--ink-muted); }
.doc .doc-date { margin-top: auto; padding-top: var(--space-4); font-size: 0.875rem; color: var(--ink-muted); }

/* ------------------------------------------------- steps and support */
.steps { max-width: var(--measure); }
.steps h3 { margin: var(--space-8) 0 var(--space-3); }
.steps h3:first-child { margin-top: 0; }
.steps ol { padding-left: 1.4em; }
.steps li + li { margin-top: var(--space-2); }
.steps li::marker { color: var(--ink-muted); }
.steps p { margin-top: var(--space-3); color: var(--ink-muted); }
.path { font-weight: 600; }

.support-contact {
  max-width: var(--measure);
  margin-bottom: var(--space-8);
}
.support-contact .email { font-size: 1.1875rem; }

/* ------------------------------------------------------------------ faq */
.faq { max-width: var(--measure); border-bottom: 1px solid var(--border); }
.faq details { border-top: 1px solid var(--border); }
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 56px;
  padding-block: var(--space-3);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  margin-right: var(--space-1);
  border-right: 1.5px solid var(--ink-muted);
  border-bottom: 1.5px solid var(--ink-muted);
  transform: translateY(-3px) rotate(45deg);
  transition: transform 160ms ease;
}
.faq details[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.faq details > div { padding-bottom: var(--space-6); color: var(--ink-muted); }

/* ---------------------------------------------------------------- todo
 * A visible placeholder for content only the owner can supply.
 * tests/check_site.py --release fails while any remain. */
.todo {
  display: block;
  max-width: var(--measure);
  padding: var(--space-3) var(--space-4);
  border: 2px dashed var(--status-warning);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.9375rem;
  line-height: 1.5;
}
.todo + .todo { margin-top: var(--space-3); }
.prose + .todo { margin-top: var(--space-6); }
span.todo { display: inline-block; }

/* -------------------------------------------------------------- footer */
.site-footer {
  margin-top: var(--section-space);
  padding-block: var(--space-8) var(--space-12);
  border-top: 1px solid var(--border);
  font-size: 0.9375rem;
  color: var(--ink-muted);
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3) var(--space-6);
}
.site-footer ul { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-6); list-style: none; padding: 0; }
.site-footer a { color: var(--ink-muted); }
.site-footer a:hover { color: var(--ink); }

/* ---------------------------------------------------------- motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ------------------------------------------------------------ timeline
 * The About section: a real sequence, newest first, so it is an <ol>. */
.timeline {
  max-width: 52rem;
  list-style: none;
  padding: 0;
  border-bottom: 1px solid var(--border);
}
.timeline > li {
  display: grid;
  gap: var(--space-2);
  padding-block: var(--space-6);
  border-top: 1px solid var(--border);
}
.timeline .when { font-size: 0.9375rem; color: var(--ink-muted); }
.timeline h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.3125rem; }
.timeline h3 + p { margin-top: var(--space-2); max-width: var(--measure); }
@media (min-width: 720px) {
  .timeline > li { grid-template-columns: 12rem minmax(0, 1fr); gap: var(--space-8); }
  .timeline .when { padding-top: 0.2em; }
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-8);
  margin-top: var(--space-6);
  padding: 0;
  list-style: none;
  font-size: 1.1875rem;
}
.contact-links a { display: inline-block; padding-block: var(--space-2); }
