/* EachPayday docs (docs.eachpayday.com.au). Tokens are canonical, copied from
   landing/index.html (zinc neutrals + orange accent). Do not invent colours. */

:root {
  --accent: #cc5818;
  --accent-hover: #b54e15;
  --accent-text: #cc5818;
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #09090b;
  --text-soft: #71717a;
  --border: #e4e4e7;
  --shadow: 0 1px 3px rgba(9, 9, 11, 0.07), 0 8px 24px rgba(9, 9, 11, 0.06);
  --radius: 0.5rem;
}
html[data-theme='dark'] {
  --accent-text: #fb923c;
  --bg: #09090b;
  --surface: #18181b;
  --text: #fafafa;
  --text-soft: #a1a1aa;
  --border: #27272a;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme='light']) {
    --accent-text: #fb923c;
    --bg: #09090b;
    --surface: #18181b;
    --text: #fafafa;
    --text-soft: #a1a1aa;
    --border: #27272a;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

/* Layout + type: the landing page's own scales, verbatim */
:root {
  --container: 84rem;
  --gutter: clamp(1.25rem, 4vw, 2rem);
  --s-1: 0.75rem;
  --s0: 1rem;
  --s1: 1.5rem;
  --s2: 2rem;
  --s3: 3rem;
  --s4: 4rem;
  --s5: clamp(3rem, 5vw, 5rem);
  --text-sm: clamp(0.9rem, 0.87rem + 0.15vw, 0.97rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.1rem, 1rem + 0.5vw, 1.3rem);
  --text-xl: clamp(1.35rem, 1.2rem + 0.8vw, 1.7rem);
  --text-2xl: clamp(1.7rem, 1.4rem + 1.6vw, 2.4rem);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }

/* Header, matching the landing page */
header.site { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 1.1rem 0; }
.logo { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; color: var(--text); text-decoration: none; }
.logo span { color: var(--accent-text); }
.header-right { display: flex; align-items: center; gap: 0.75rem; }
.nav-link { color: var(--text-soft); text-decoration: none; font-size: 0.875rem; font-weight: 500; white-space: nowrap; }
.nav-link:hover { color: var(--text); }
.app-link {
  font-size: 0.875rem; font-weight: 600; color: var(--accent-text); text-decoration: none;
  border: 1px solid var(--accent-text); border-radius: var(--radius); padding: 0.35rem 0.75rem; white-space: nowrap;
}
.app-link:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; border-radius: var(--radius);
  background: none; border: 1px solid var(--border); color: var(--text-soft);
  cursor: pointer; padding: 0;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text-soft); }
.theme-toggle svg { width: 1.1rem; height: 1.1rem; }
.icon-sun { display: none; }
html[data-theme='dark'] .icon-sun { display: block; }
html[data-theme='dark'] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme='light']) .icon-sun { display: block; }
  html:not([data-theme='light']) .icon-moon { display: none; }
}
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Index. Grid steps mirror the landing feature strip: 1-up mobile,
   2-up >=560px, 3-across >=960px. */
.doc-hero { padding: var(--s3) 0 var(--s1); }
.doc-hero h1 { font-size: var(--text-2xl); font-weight: 800; letter-spacing: -0.02em; }
.doc-hero .sub { color: var(--text-soft); font-size: var(--text-lg); max-width: 46ch; margin-top: 0.5rem; }
.topic-grid { display: grid; grid-template-columns: 1fr; gap: var(--s0); padding-bottom: var(--s4); }
@media (min-width: 560px) { .topic-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .topic-grid { grid-template-columns: 1fr 1fr 1fr; } }
.topic-card {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: var(--s1) var(--s1); text-decoration: none; color: var(--text);
}
.topic-card:hover { border-color: var(--text-soft); }
.topic-card h2 { font-size: var(--text-lg); font-weight: 700; }
.topic-card p { color: var(--text-soft); font-size: var(--text-sm); margin-top: 0.25rem; }
.topic-card .more { display: inline-block; margin-top: var(--s-1); font-size: var(--text-sm); font-weight: 600; color: var(--accent-text); }

/* Topic pages: single column on phones/tablets; at >=900px (the app's own
   multi-column breakpoint) a sticky topic sidebar + the article, so desktop
   width is used the same way the landing and app use it. The article body
   keeps a readable measure inside the wide container. */
.doc-layout { display: grid; grid-template-columns: 1fr; gap: var(--s2); padding: var(--s1) 0 var(--s4); }
.doc-side { display: none; }
@media (min-width: 900px) {
  .doc-layout { grid-template-columns: 16rem minmax(0, 1fr); }
  .doc-side {
    display: flex; flex-direction: column; gap: 0.25rem;
    position: sticky; top: var(--s1); align-self: start;
    padding-right: var(--s1); border-right: 1px solid var(--border);
  }
}
.doc-side .side-head { font-size: var(--text-sm); font-weight: 700; margin-bottom: 0.5rem; }
.doc-side .side-head a { color: var(--text); text-decoration: none; }
.doc-side a { color: var(--text-soft); text-decoration: none; font-size: var(--text-sm); padding: 0.3rem 0; }
.doc-side a:hover { color: var(--text); }
.doc-side a[aria-current='page'] { color: var(--accent-text); font-weight: 600; }

/* Article */
.doc { max-width: 44rem; min-width: 0; }
.crumb { font-size: var(--text-sm); color: var(--text-soft); margin-bottom: var(--s-1); }
.crumb a { color: inherit; text-decoration: none; }
.crumb a:hover { color: var(--text); }
.doc h1 { font-size: var(--text-2xl); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; margin-bottom: var(--s0); }
.doc h2 { font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.01em; margin: var(--s2) 0 0.5rem; }
.doc p { margin: var(--s-1) 0; }
.doc ul, .doc ol { margin: var(--s-1) 0; padding-left: var(--s1); }
.doc li { margin: 0.5rem 0; }
.doc a { color: var(--accent-text); }
.doc strong { font-weight: 600; }
.topic-nav {
  display: flex; justify-content: space-between; gap: var(--s0);
  border-top: 1px solid var(--border); margin-top: var(--s2); padding-top: var(--s0);
  font-size: var(--text-sm); font-weight: 600;
}
.topic-nav a { color: var(--accent-text); text-decoration: none; }
.topic-nav a:hover { text-decoration: underline; }

/* Footer, matching the landing page */
footer.site {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 2.5rem; font-size: 0.75rem; color: var(--text-soft);
}
footer.site p { margin: 0.35rem 0; }
footer.site a { color: inherit; }
