/* Shared styles for the standalone guide pages in the landing root
   (why-make-habits-public.html, comparison.html, etc.). The homepage keeps its
   own inline styles; the palette and type here mirror index.html (and
   publichabits/config/styles.js). */
:root {
  --background: rgba(248, 246, 241, 1);
  --surface: rgba(250, 249, 246, 1);
  --elevated-surface: rgba(255, 255, 255, 1);
  --text: rgba(34, 34, 34, 1);
  --muted-text: rgba(100, 100, 100, 1);
  --soft-text: rgba(34, 34, 34, 0.42);
  --primary: rgb(75, 179, 165);
  --primary-strong: rgb(58, 156, 143);
  --primary-tint: rgba(75, 179, 165, 0.12);
  --danger: rgba(188, 90, 72, 1);
  --border: rgba(34, 34, 34, 0.15);
  --strong-border: rgba(34, 34, 34, 0.16);
  --divider: rgba(34, 34, 34, 0.1);
  --card-radius: 16px;
  --control-radius: 12px;
  --container: 1080px;
  --article: 740px;
  --display-font: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body-font: "IBM Plex Sans", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  background:
    radial-gradient(
      circle at 14% -8%,
      rgba(75, 179, 165, 0.16),
      transparent 40%
    ),
    radial-gradient(
      circle at 92% 4%,
      rgba(108, 172, 164, 0.12),
      transparent 44%
    ),
    var(--background);
}

body {
  color: var(--text);
  font-family: var(--body-font);
  line-height: 1.65;
  min-height: 100vh;
  background: transparent;
}

a {
  color: var(--primary-strong);
}

img {
  max-width: 100%;
}

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--elevated-surface);
  border: 1px solid var(--strong-border);
  border-radius: 10px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  transition: top 0.16s ease;
}

.skip-link:focus {
  top: 16px;
}

.wrap {
  width: min(var(--container), 100% - 40px);
  margin-inline: auto;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: var(--control-radius);
  border: 1px solid transparent;
  text-decoration: none;
  font-family: var(--body-font);
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background-color 0.16s ease;
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 22px rgba(75, 179, 165, 0.32);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--primary-strong);
  box-shadow: 0 12px 26px rgba(75, 179, 165, 0.42);
}

.btn-sm {
  min-height: 42px;
  padding: 0 16px;
  font-size: 11px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(248, 246, 241, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--divider);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.brand-logo {
  display: block;
  height: 38px;
  width: auto;
}

.header-cta {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
}

.header-link {
  color: var(--muted-text);
  font-weight: 500;
  font-size: 15px;
  text-decoration: none;
}

.header-link:hover,
.header-link:focus-visible {
  color: var(--text);
}

/* ---------- Article ---------- */
.article {
  width: min(var(--article), 100% - 40px);
  margin: 0 auto;
  padding: 28px 0 24px;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0 0 28px;
  padding: 0;
  list-style: none;
  font-size: 14px;
  color: var(--muted-text);
}

/* Out-specify the .article list rules further down */
.article .breadcrumbs li {
  margin: 0;
  font-size: 14px;
}

.breadcrumbs li + li::before {
  content: "/";
  margin-right: 8px;
  color: var(--soft-text);
}

.breadcrumbs a {
  color: var(--muted-text);
}

.eyebrow {
  margin: 0 0 10px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--primary-strong);
}

.article h1 {
  margin: 0 0 18px;
  font-family: var(--display-font);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: clamp(36px, 6vw, 56px);
  line-height: 0.98;
}

.lede {
  margin: 0 0 16px;
  font-size: clamp(18px, 2vw, 20px);
  line-height: 1.6;
}

.byline {
  margin: 0;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--divider);
  color: var(--muted-text);
  font-size: 14px;
}

.article h2 {
  margin: 52px 0 14px;
  font-family: var(--display-font);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-size: clamp(27px, 3.6vw, 36px);
  line-height: 1.02;
  scroll-margin-top: 84px;
}

.article h3 {
  margin: 30px 0 8px;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.35;
}

.article p,
.article li {
  font-size: 17px;
}

.article p {
  margin: 0 0 16px;
}

.article ul,
.article ol {
  margin: 0 0 18px;
  padding-left: 22px;
}

.article li + li {
  margin-top: 8px;
}

.article strong {
  font-weight: 600;
}

.article code {
  padding: 1px 6px;
  background: rgba(34, 34, 34, 0.06);
  border-radius: 6px;
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

/* Callout */
.note {
  margin: 24px 0;
  padding: 16px 20px;
  background: var(--primary-tint);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--control-radius) var(--control-radius) 0;
}

.note p:last-child {
  margin-bottom: 0;
}

/* Numbered workflow */
.article ol.steps-list {
  counter-reset: step;
  list-style: none;
  padding-left: 0;
}

.steps-list > li {
  counter-increment: step;
  position: relative;
  padding-left: 48px;
}

.steps-list > li + li {
  margin-top: 18px;
}

.steps-list > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-family: var(--display-font);
  font-weight: 600;
  font-size: 17px;
}

/* Definitions */
.terms {
  margin: 0 0 18px;
}

.terms dt {
  margin-top: 16px;
  font-weight: 600;
  font-size: 17px;
}

.terms dd {
  margin: 4px 0 0;
  color: var(--muted-text);
  font-size: 16px;
}

/* ---------- Tables ---------- */
.table-scroll {
  margin: 20px 0 24px;
  overflow-x: auto;
  background: var(--elevated-surface);
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  box-shadow: 0 6px 18px rgba(34, 34, 34, 0.05);
}

.table-scroll:focus-visible {
  outline-offset: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  line-height: 1.5;
}

/* Many-column tables break out of the text column (up to 1000px) instead of
   squeezing; below that they scroll inside .table-scroll. */
.table-wide {
  position: relative;
  left: 50%;
  width: min(1000px, 100vw - 40px);
  transform: translateX(-50%);
}

.table-wide table {
  min-width: 760px;
}

caption {
  padding: 14px 16px 0;
  text-align: left;
  color: var(--muted-text);
  font-size: 13px;
}

/* Opt-in: put the caption under the table instead of above it. */
.caption-bottom {
  caption-side: bottom;
}

.caption-bottom caption {
  padding: 12px 16px 14px;
  border-top: 1px solid var(--divider);
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--divider);
}

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

thead th {
  background: var(--surface);
  color: var(--muted-text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody th {
  min-width: 140px;
  font-weight: 600;
}

tbody th .examples {
  display: block;
  margin-top: 2px;
  color: var(--muted-text);
  font-size: 13px;
  font-weight: 400;
}

tr.is-publichabits {
  background: rgba(75, 179, 165, 0.07);
}

.yes,
.no {
  display: inline-block;
  min-width: 36px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
}

.yes {
  background: var(--primary-tint);
  color: var(--primary-strong);
}

.no {
  background: rgba(34, 34, 34, 0.06);
  color: var(--muted-text);
}

/* Check / X icons in yes-no tables: solid fills with different hues and
   shapes so they read apart at a glance, including with color blindness. */
.mark {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #fff;
  vertical-align: middle;
}

.mark svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mark-yes {
  background: var(--primary-strong);
}

.mark-no {
  background: var(--danger);
}

/* ---------- Screenshots ---------- */
.shots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin: 26px 0 30px;
}

.shots-single {
  grid-template-columns: minmax(0, 1fr);
}

.shot {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.shot figcaption {
  color: var(--muted-text);
  font-size: 14px;
  text-align: center;
  max-width: 30ch;
}

.phone {
  width: min(240px, 100%);
  background: #1c1c1e;
  border-radius: 34px;
  padding: 9px;
  box-shadow: 0 20px 44px rgba(34, 34, 34, 0.2);
}

.phone img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 472 / 1024;
  border-radius: 26px;
}

.browser {
  width: min(300px, 100%);
  background: var(--elevated-surface);
  border: 1px solid var(--strong-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(34, 34, 34, 0.12);
}

.browser-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
}

.browser-dots {
  display: inline-flex;
  gap: 6px;
}

.browser-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border);
}

.browser-url {
  flex: 1;
  min-width: 0;
  padding: 3px 10px;
  background: var(--elevated-surface);
  border: 1px solid var(--divider);
  border-radius: 999px;
  font-size: 11px;
  color: var(--muted-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.browser img {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------- FAQ ---------- */
.faq-list {
  display: grid;
  gap: 12px;
  margin: 20px 0 0;
}

details.faq {
  background: var(--elevated-surface);
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  padding: 4px 20px;
  box-shadow: 0 6px 18px rgba(34, 34, 34, 0.05);
}

details.faq summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 0;
  font-weight: 600;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

details.faq summary::after {
  content: "+";
  font-size: 24px;
  color: var(--primary-strong);
  line-height: 1;
  transition: transform 0.16s ease;
}

details.faq[open] summary::after {
  transform: rotate(45deg);
}

.article details.faq p {
  margin: 0 0 18px;
  color: var(--muted-text);
  font-size: 15.5px;
}

/* ---------- CTA box ---------- */
.cta-box {
  margin: 56px 0 0;
  padding: 32px 28px;
  text-align: center;
  background: var(--elevated-surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  box-shadow: 0 12px 30px rgba(34, 34, 34, 0.06);
}

.article .cta-box h2 {
  margin: 0 0 10px;
}

.cta-box p {
  max-width: 48ch;
  margin-inline: auto;
  color: var(--muted-text);
}

/* Same layout as the homepage hero: the button spans the first row and the
   two store badges share the second. */
.cta-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 162px));
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.cta-actions .btn {
  grid-column: 1 / -1;
}

.store-badge {
  display: block;
  line-height: 0;
}

.store-badge img {
  display: block;
  width: 100%;
  height: 48px;
  object-fit: contain;
}

/* ---------- Related guides ---------- */
.related {
  margin: 56px 0 0;
}

.article .related h2 {
  margin-top: 0;
  font-size: clamp(22px, 3vw, 28px);
}

.article .related-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.article .related-grid li {
  margin: 0;
}

.related-grid a {
  display: block;
  height: 100%;
  padding: 16px 18px;
  background: var(--elevated-surface);
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  color: var(--text);
  text-decoration: none;
  transition:
    border-color 0.16s ease,
    transform 0.16s ease;
}

.related-grid a:hover,
.related-grid a:focus-visible {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.related-grid strong {
  display: block;
  font-size: 16px;
}

.related-grid span {
  display: block;
  margin-top: 2px;
  color: var(--muted-text);
  font-size: 14px;
}

/* ---------- Footer ---------- */
footer {
  margin-top: 72px;
  border-top: 1px solid var(--border);
  padding: 36px 0;
  background: var(--surface);
}

.footer-inner {
  display: grid;
  gap: 20px;
}

footer .brand-logo {
  height: 30px;
}

.footer-guides {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.footer-guides a,
.footer-links a {
  color: var(--text);
  text-decoration-color: var(--border);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  color: var(--muted-text);
  font-size: 14px;
}

.footer-sep {
  color: var(--soft-text);
}

.footer-copy {
  margin: 0;
  color: var(--soft-text);
  font-size: 13px;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .header-link {
    display: none;
  }

  /* Wide tables become one card per row; each <td> carries a data-label
     copied from its column header. */
  .table-wide {
    left: auto;
    width: auto;
    transform: none;
    overflow: visible;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .table-wide table {
    min-width: 0;
  }

  /* A table-caption inside a display:block table shrinks to one word wide. */
  .table-wide caption {
    display: block;
    padding: 0 0 10px;
  }

  /* A block table ignores caption-side, so use flex order to put the
     caption after the row cards. */
  .table-wide .caption-bottom {
    display: flex;
    flex-direction: column;
  }

  .table-wide .caption-bottom caption {
    order: 1;
    padding: 0;
    border-top: 0;
  }

  .table-wide thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .table-wide table,
  .table-wide tbody,
  .table-wide tr,
  .table-wide th,
  .table-wide td {
    display: block;
  }

  .table-wide tbody tr {
    margin-bottom: 12px;
    padding-bottom: 8px;
    background: var(--elevated-surface);
    border: 1px solid var(--border);
    border-radius: var(--control-radius);
    box-shadow: 0 6px 18px rgba(34, 34, 34, 0.05);
  }

  .table-wide tbody tr.is-publichabits {
    background: rgba(75, 179, 165, 0.07);
    border-color: var(--primary);
  }

  .table-wide tbody th {
    margin-bottom: 4px;
    font-size: 16px;
    border-bottom: 1px solid var(--divider);
  }

  .table-wide tbody td {
    padding: 6px 14px;
    border-bottom: 0;
  }

  .table-wide td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted-text);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
  }

  .site-header .brand-logo {
    width: 100%;
    max-width: 163px;
    height: auto;
  }

  .article h2 {
    margin-top: 44px;
  }

  .shots,
  .article .related-grid {
    grid-template-columns: 1fr;
  }

  .cta-box {
    padding: 28px 18px;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
