/* HabitStakes — static site styles.
   No external fonts, no scripts, no third-party assets. */

:root {
  --ink: #17211b;
  --ink-deep: #101812;
  --ink-soft: #3a473f;
  --muted: #5a6660;
  --cream: #f7f5ee;
  --cream-2: #f1eee4;
  --surface: #ffffff;
  --line: rgba(23, 33, 27, 0.12);
  --line-strong: rgba(23, 33, 27, 0.22);
  --coral: #f18b6d;
  --coral-deep: #b03d18;
  --coral-wash: #fdece5;
  --green: #159a67;
  --green-deep: #0f7a51;
  --mint: #ddf5e9;
  --on-dark: #f4f1e8;
  --on-dark-muted: #b2cbba;

  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow-card: 0 1px 2px rgba(23, 33, 27, 0.05), 0 18px 34px -22px rgba(23, 33, 27, 0.35);
  --shadow-lift: 0 2px 6px rgba(23, 33, 27, 0.07), 0 30px 50px -26px rgba(23, 33, 27, 0.45);
  --wrap: 1120px;
  --pad: clamp(1.15rem, 4vw, 2.5rem);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.075rem);
  line-height: 1.62;
  letter-spacing: -0.005em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  line-height: 1.12;
  letter-spacing: -0.028em;
  margin: 0 0 0.55em;
  font-weight: 750;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.25rem, 1.5rem + 3.4vw, 3.9rem);
}

h2 {
  font-size: clamp(1.6rem, 1.25rem + 1.7vw, 2.4rem);
}

h3 {
  font-size: clamp(1.12rem, 1.03rem + 0.45vw, 1.3rem);
  letter-spacing: -0.02em;
}

p,
ul,
ol,
dl {
  margin: 0 0 1.05em;
}

li {
  margin-bottom: 0.4em;
}

li:last-child {
  margin-bottom: 0;
}

a {
  color: var(--green-deep);
  text-underline-offset: 0.18em;
  text-decoration-thickness: from-font;
}

a:hover {
  color: var(--coral-deep);
}

strong {
  font-weight: 700;
}

abbr[title] {
  text-decoration-style: dotted;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

img {
  max-width: 100%;
  height: auto;
}

figure {
  margin: 0;
}

code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: rgba(23, 33, 27, 0.07);
  padding: 0.12em 0.4em;
  border-radius: 6px;
}

:focus-visible {
  outline: 3px solid var(--coral-deep);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--pad);
}

.wrap-narrow {
  max-width: 780px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--ink);
  color: var(--on-dark);
  padding: 0.7rem 1.1rem;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 650;
}

.skip:focus {
  left: 0;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(247, 245, 238, 0.82);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 4rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  font-size: 1.06rem;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}

.brand img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(23, 33, 27, 0.3);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.35rem, 1.4vw, 1.1rem);
  flex-wrap: wrap;
  font-size: 0.94rem;
}

.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.35rem 0.15rem;
  font-weight: 550;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover {
  color: var(--ink);
  border-bottom-color: var(--coral);
}

.site-nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--coral-deep);
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(80rem 40rem at 88% -12%, rgba(241, 139, 109, 0.28), transparent 60%),
    radial-gradient(50rem 30rem at 4% 8%, rgba(21, 154, 103, 0.22), transparent 62%),
    linear-gradient(168deg, #1b2620 0%, var(--ink) 45%, var(--ink-deep) 100%);
  color: var(--on-dark);
  padding-block: clamp(3rem, 7vw, 5.5rem) clamp(3rem, 7vw, 5rem);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 -1px 0;
  height: 3px;
  background: linear-gradient(90deg, var(--green), var(--coral));
  opacity: 0.85;
}

.hero-grid {
  display: grid;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: center;
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.85fr);
  }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--coral);
  margin: 0 0 1rem;
}

.eyebrow .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--coral);
}

.hero h1 {
  margin-bottom: 0.5em;
}

.hero h1 .accent {
  color: var(--coral);
}

.hero-lede {
  font-size: clamp(1.05rem, 0.98rem + 0.5vw, 1.28rem);
  color: var(--on-dark-muted);
  max-width: 34em;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
  margin: 1.8rem 0 1.4rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.95rem 1.5rem;
  border-radius: 999px;
  font-weight: 680;
  font-size: 1rem;
  text-decoration: none;
  border: 1.5px solid transparent;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.btn-primary {
  background: var(--coral);
  color: #2a1206;
  border-color: var(--coral);
}

.btn-primary:hover {
  background: #f79f85;
  color: #2a1206;
  transform: translateY(-1px);
}

.btn-ghost {
  color: var(--on-dark);
  border-color: rgba(244, 241, 232, 0.4);
}

.btn-ghost:hover {
  color: var(--on-dark);
  border-color: var(--on-dark);
  background: rgba(244, 241, 232, 0.08);
  transform: translateY(-1px);
}

.btn:active {
  transform: scale(0.985);
}

.cta-note {
  font-size: 0.9rem;
  color: var(--on-dark-muted);
  margin: 0;
}

.hero-facts {
  list-style: none;
  padding: 0;
  margin: 1.8rem 0 0;
  display: grid;
  gap: 0.55rem;
  font-size: 0.95rem;
  color: var(--on-dark-muted);
}

.hero-facts li {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin: 0;
}

.hero-facts .tick {
  color: var(--green);
  font-weight: 800;
  line-height: 1.5;
}

/* ---------- device frame ---------- */

.device {
  position: relative;
  margin-inline: auto;
  width: min(280px, 74vw);
  padding: 10px;
  border-radius: 46px;
  background: linear-gradient(160deg, #39463e, #10170f);
  box-shadow: 0 40px 70px -30px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

.device img {
  display: block;
  width: 100%;
  border-radius: 37px;
  background: var(--cream);
}

.device::before {
  content: "";
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  width: 32%;
  height: 22px;
  border-radius: 999px;
  background: #0b0f0c;
  z-index: 2;
}

.device-caption {
  margin: 1rem auto 0;
  max-width: 30ch;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.hero .device-caption {
  color: var(--on-dark-muted);
}

/* ---------- sections ---------- */

section {
  padding-block: clamp(2.75rem, 6vw, 4.75rem);
}

.section-head {
  max-width: 46rem;
  margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
}

.section-head p {
  color: var(--muted);
  font-size: clamp(1rem, 0.97rem + 0.25vw, 1.12rem);
  margin-bottom: 0;
}

.kicker {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--coral-deep);
  margin: 0 0 0.7rem;
}

.band-dark {
  background: linear-gradient(165deg, var(--ink) 0%, var(--ink-deep) 100%);
  color: var(--on-dark);
}

.band-dark .kicker {
  color: var(--coral);
}

.band-dark .section-head p,
.band-dark p {
  color: var(--on-dark-muted);
}

.band-dark h2,
.band-dark h3 {
  color: var(--on-dark);
}

.band-dark a {
  color: var(--coral);
}

/* Buttons keep their own colours inside dark bands: `.band-dark a` would
   otherwise out-specify `.btn-primary` and paint coral text on coral. */
.band-dark a.btn-primary,
.band-dark a.btn-primary:hover,
.band-dark a.btn-primary:focus,
.band-dark a.btn-primary:focus-visible,
.band-dark a.btn-primary:active {
  color: #2a1206;
}

.band-dark a.btn-ghost,
.band-dark a.btn-ghost:hover,
.band-dark a.btn-ghost:focus,
.band-dark a.btn-ghost:focus-visible,
.band-dark a.btn-ghost:active {
  color: var(--on-dark);
}

.band-tint {
  background: linear-gradient(180deg, var(--cream) 0%, var(--cream-2) 100%);
}

/* ---------- cards & grids ---------- */

.grid {
  display: grid;
  gap: clamp(0.9rem, 2vw, 1.35rem);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1.3rem, 2.4vw, 1.7rem);
  box-shadow: var(--shadow-card);
}

.card h3 {
  margin-bottom: 0.45em;
}

.card p:last-child,
.card ul:last-child {
  margin-bottom: 0;
}

.card .meta {
  font-size: 0.9rem;
  color: var(--muted);
}

.band-dark .card {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(244, 241, 232, 0.16);
  box-shadow: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.3rem 0.66rem;
  border-radius: 999px;
  margin-bottom: 0.9rem;
}

.badge-green {
  background: var(--mint);
  color: var(--green-deep);
}

.badge-coral {
  background: var(--coral-wash);
  color: var(--coral-deep);
}

.badge-slate {
  background: rgba(23, 33, 27, 0.07);
  color: var(--ink-soft);
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 14px;
  background: var(--ink);
  color: var(--on-dark);
  font-weight: 750;
  font-size: 1.05rem;
  margin-bottom: 1rem;
}

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 15px;
  background: var(--mint);
  margin-bottom: 1rem;
}

.card-icon svg {
  width: 1.35rem;
  height: 1.35rem;
  fill: none;
  stroke: var(--green-deep);
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card-icon.coral {
  background: var(--coral-wash);
}

.card-icon.coral svg {
  stroke: var(--coral-deep);
}

/* ---------- notice callouts ---------- */

.notice {
  border-radius: var(--radius-lg);
  padding: clamp(1.15rem, 2.4vw, 1.6rem) clamp(1.2rem, 2.6vw, 1.75rem);
  border: 1px solid var(--line);
  background: var(--surface);
}

.notice h2,
.notice h3 {
  margin-top: 0;
  font-size: 1.12rem;
}

.notice p:last-child,
.notice ul:last-child {
  margin-bottom: 0;
}

.notice-coral {
  background: var(--coral-wash);
  border-color: rgba(176, 61, 24, 0.28);
  color: #3d1a0c;
}

.notice-coral a {
  color: var(--coral-deep);
}

.notice-mint {
  background: var(--mint);
  border-color: rgba(15, 122, 81, 0.3);
  color: #0d2a1e;
}

.notice-plain {
  background: rgba(23, 33, 27, 0.04);
}

.notice-inline {
  margin-block: 1.75rem;
}

.band-dark .notice {
  background: rgba(241, 139, 109, 0.12);
  border-color: rgba(241, 139, 109, 0.45);
  color: var(--on-dark);
}

.band-dark .notice p {
  color: #f2ddd3;
}

/* ---------- table ---------- */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 34rem;
  font-size: 0.96rem;
}

caption {
  text-align: left;
  padding: 1rem 1.2rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  padding: 0.85rem 1.2rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

thead th {
  font-size: 0.78rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td strong {
  display: block;
}

/* ---------- screenshot gallery ---------- */

.shots {
  display: grid;
  gap: clamp(1.5rem, 4vw, 2.5rem);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  align-items: start;
}

.shots .device {
  width: min(240px, 70vw);
  border-radius: 40px;
  padding: 8px;
}

.shots .device img {
  border-radius: 33px;
}

.shots .device::before {
  top: 18px;
  height: 18px;
}

/* ---------- faq ---------- */

.faq {
  display: grid;
  gap: 0.75rem;
}

details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.35rem 1.15rem;
}

details[open] {
  border-color: var(--line-strong);
}

summary {
  cursor: pointer;
  font-weight: 650;
  padding: 0.85rem 0;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1;
  color: var(--coral-deep);
  transition: transform 0.2s ease;
}

details[open] summary::after {
  content: "\2212";
}

details > *:not(summary) {
  margin-top: 0;
}

details > p:last-child,
details > ul:last-child {
  padding-bottom: 0.9rem;
  margin-bottom: 0;
}

/* ---------- documents ---------- */

.doc-header {
  background: linear-gradient(168deg, #1b2620 0%, var(--ink) 60%, var(--ink-deep) 100%);
  color: var(--on-dark);
  padding-block: clamp(2.25rem, 5vw, 3.5rem);
}

.doc-header h1 {
  font-size: clamp(1.95rem, 1.4rem + 2.4vw, 3rem);
  margin-bottom: 0.4em;
}

.doc-header p {
  color: var(--on-dark-muted);
  max-width: 46rem;
}

.doc-meta {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  font-size: 0.88rem;
  color: var(--on-dark-muted);
}

.doc-meta li {
  margin: 0;
}

.doc-meta strong {
  color: var(--on-dark);
  font-weight: 650;
}

.doc-layout {
  display: grid;
  gap: clamp(1.75rem, 4vw, 3rem);
  align-items: start;
  padding-block: clamp(2rem, 5vw, 3.25rem);
}

@media (min-width: 940px) {
  .doc-layout {
    grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  }

  .toc {
    position: sticky;
    top: 5.25rem;
  }
}

.toc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-card);
  font-size: 0.92rem;
}

.toc h2 {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.85rem;
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc;
}

.toc li {
  margin-bottom: 0.15rem;
}

.toc a {
  display: block;
  padding: 0.32rem 0;
  color: var(--ink-soft);
  text-decoration: none;
  border-left: 2px solid transparent;
  padding-left: 0.65rem;
}

.toc a:hover {
  color: var(--coral-deep);
  border-left-color: var(--coral);
}

.doc-body {
  max-width: 46rem;
}

.doc-body h2 {
  font-size: clamp(1.3rem, 1.1rem + 0.9vw, 1.7rem);
  margin-top: 2.5rem;
  padding-top: 0.35rem;
}

.doc-body > h2:first-child {
  margin-top: 0;
}

.doc-body h3 {
  margin-top: 1.9rem;
}

.doc-body ul,
.doc-body ol {
  padding-left: 1.25rem;
}

.doc-body dt {
  font-weight: 700;
  margin-top: 1rem;
}

.doc-body dd {
  margin: 0.25rem 0 0;
  color: var(--ink-soft);
}

.legal-note {
  margin-top: 2.75rem;
  font-size: 0.92rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 1.35rem;
}

.updated {
  font-size: 0.92rem;
  color: var(--muted);
}

/* ---------- 404 ---------- */

.center-page {
  min-height: 62vh;
  display: flex;
  align-items: center;
}

.center-page .wrap {
  text-align: left;
}

.link-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  display: grid;
  gap: 0.5rem;
  max-width: 26rem;
}

.link-list a {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.link-list a::after {
  content: "\203A";
  color: var(--coral-deep);
  font-size: 1.2rem;
  line-height: 1.2;
}

.link-list a:hover {
  border-color: var(--coral);
  transform: translateX(2px);
}

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

.site-footer {
  background: var(--ink-deep);
  color: var(--on-dark-muted);
  padding-block: clamp(2.5rem, 5vw, 3.5rem) 2rem;
  font-size: 0.93rem;
}

.footer-grid {
  display: grid;
  gap: clamp(1.5rem, 4vw, 2.5rem);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(244, 241, 232, 0.14);
}

.footer-grid h2 {
  font-size: 0.78rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--on-dark);
  margin-bottom: 0.9rem;
}

.footer-grid ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-grid li {
  margin-bottom: 0.5rem;
}

.footer-grid a,
.site-footer a {
  color: var(--on-dark-muted);
  text-decoration: none;
}

.footer-grid a:hover,
.site-footer a:hover {
  color: var(--coral);
  text-decoration: underline;
}

.footer-brand p {
  margin-bottom: 0.6rem;
}

.footer-brand .brand {
  color: var(--on-dark);
  margin-bottom: 0.9rem;
}

.footer-legal {
  padding-top: 1.6rem;
  display: grid;
  gap: 0.85rem;
  font-size: 0.86rem;
  color: #93a89b;
}

.footer-legal p {
  margin: 0;
  max-width: 60rem;
}

/* ---------- motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  .rise {
    animation: rise 0.7s cubic-bezier(0.22, 0.7, 0.3, 1) both;
  }

  .d2 {
    animation-delay: 0.13s;
  }

  .card,
  .link-list a {
    transition: transform 0.22s cubic-bezier(0.22, 0.7, 0.3, 1), box-shadow 0.22s ease, border-color 0.22s ease;
  }

  .card-hover:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lift);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --muted: #414b45;
    --line: rgba(23, 33, 27, 0.3);
    --on-dark-muted: #d9e6de;
  }
}

@media print {
  .site-header,
  .site-nav,
  .toc,
  .hero,
  .device {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }

  .doc-header {
    background: none;
    color: #000;
  }

  .doc-header p,
  .doc-meta {
    color: #000;
  }
}
