/* Self-hosted serif for headings. See assets/fonts/README.md for the files to drop in. */
@font-face {
  font-family: "Newsreader";
  src: url("/assets/fonts/newsreader-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Newsreader";
  src: url("/assets/fonts/newsreader-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  /* color — light warm paper */
  --bg: #f6f3ee;
  --surface: #fffdf9;
  --surface-soft: #f0ece4;
  --border: #e2dbd0;
  --text: #1c1a17;
  --muted: #6b6459;
  --muted-strong: #423d35;
  --button: #1c1a17;
  --button-text: #f6f3ee;
  --button-hover: #322d27;
  --error: #8a3324;

  /* spacing — 4px base */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --space-10: 128px;

  /* type scale */
  --step--1: 0.82rem;
  --step-0: 1rem;
  --step-1: clamp(1.08rem, 1.4vw, 1.22rem);
  --step-2: clamp(1.3rem, 2.2vw, 1.65rem);
  --step-3: clamp(1.7rem, 3vw, 2.4rem);
  --step-4: clamp(2.5rem, 5.5vw, 4rem);

  /* weights — exactly three */
  --w-regular: 400;
  --w-medium: 500;
  --w-bold: 600;

  /* fonts */
  --font-serif: "Newsreader", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;

  --radius: 8px;
  --shell: 1080px;
}

* {
  box-sizing: border-box;
}

/* Keep the hidden attribute authoritative over display rules (e.g. .portal-login uses display:grid). */
[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: var(--w-regular);
  line-height: 1.6;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

code {
  color: var(--muted-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

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

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: var(--space-2) var(--space-3);
  color: var(--button-text);
  background: var(--button);
  border-radius: var(--radius);
  transform: translateY(-140%);
}

.skip-link:focus {
  transform: translateY(0);
}

.shell {
  width: min(calc(100% - 44px), var(--shell));
  margin: 0 auto;
}

.measure {
  max-width: 62ch;
}

/* Headings */
h1,
h2,
h3 {
  margin-top: 0;
  font-family: var(--font-serif);
  font-weight: var(--w-medium);
  color: var(--text);
  letter-spacing: -0.01em;
}

h1 {
  margin-bottom: var(--space-5);
  font-size: var(--step-4);
  line-height: 1.05;
}

h2 {
  margin-bottom: var(--space-3);
  font-size: var(--step-3);
  line-height: 1.15;
}

h3 {
  margin-bottom: var(--space-2);
  font-size: var(--step-2);
  line-height: 1.25;
}

p {
  margin-top: 0;
  color: var(--muted-strong);
  font-size: var(--step-0);
}

.kicker {
  margin: 0 0 var(--space-4);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: var(--step--1);
  font-weight: var(--w-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.nav {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}

.brand {
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: var(--w-medium);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  font-size: 0.95rem;
}

.nav-link {
  color: var(--muted-strong);
  font-weight: var(--w-medium);
}

.nav-link:hover {
  color: var(--text);
}

/* Buttons */
.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-5);
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-5);
  border: 1px solid var(--button);
  border-radius: var(--radius);
  color: var(--button-text);
  background: var(--button);
  font-size: 0.95rem;
  font-weight: var(--w-medium);
  cursor: pointer;
}

.button:hover {
  color: var(--button-text);
  background: var(--button-hover);
  border-color: var(--button-hover);
}

.button-secondary {
  color: var(--text);
  background: transparent;
  border-color: var(--border);
}

.button-secondary:hover {
  color: var(--text);
  background: var(--surface-soft);
  border-color: var(--border);
}

.button-small {
  min-height: 38px;
  padding: var(--space-2) var(--space-4);
  font-size: 0.9rem;
}

.text-link {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  font-weight: var(--w-medium);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--border);
}

.text-link:hover {
  text-decoration-color: var(--text);
}

.quiet-link {
  color: var(--muted-strong);
  font-weight: var(--w-medium);
}

.quiet-link:hover {
  color: var(--text);
}

/* Hero */
.hero {
  padding: var(--space-10) 0;
}

.hero-copy {
  max-width: 760px;
}

.hero-copy > p:not(.kicker) {
  margin-bottom: var(--space-6);
  font-size: var(--step-1);
}

.hero-note {
  margin: var(--space-5) 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Section rhythm */
.editorial-section,
.how-section,
.portal-preview,
.closing {
  padding: var(--space-9) 0;
  border-top: 1px solid var(--border);
}

.section-heading {
  max-width: 640px;
  margin-bottom: var(--space-7);
}

/* What we build — numbered rows */
.text-rows {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--border);
}

.text-rows article {
  display: grid;
  grid-template-columns: 3.5rem minmax(220px, 0.3fr) minmax(0, 1fr);
  gap: var(--space-6);
  padding: var(--space-6) 0;
  border-bottom: 1px solid var(--border);
}

.row-number {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: var(--w-regular);
  font-variant-numeric: tabular-nums;
}

.text-rows p {
  margin-bottom: 0;
}

/* How we work */
.how-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-6);
  border-top: 1px solid var(--border);
  padding-top: var(--space-6);
}

.how-list h3 {
  font-size: var(--step-1);
}

.how-list p {
  margin: 0;
  color: var(--muted);
}

/* Portal preview (homepage) */
.portal-preview {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(260px, 0.36fr);
  gap: var(--space-7);
  align-items: start;
}

.portal-preview h2 {
  font-size: var(--step-2);
}

.portal-preview p {
  margin-bottom: var(--space-4);
  color: var(--muted);
}

/* Closing CTA band */
.closing {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}

.closing h2 {
  margin: 0;
  font-size: var(--step-2);
}

/* Portal page */
.portal-main {
  padding: var(--space-8) 0 var(--space-9);
}

.portal-heading {
  max-width: 700px;
  margin-bottom: var(--space-6);
}

.portal-heading p {
  font-size: var(--step-1);
}

.portal-notice {
  max-width: 780px;
  margin-bottom: var(--space-7);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.portal-notice p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.portal-notice a,
.footer-simple a {
  color: var(--muted-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.portal-notice a:hover,
.footer-simple a:hover {
  color: var(--text);
}

.portal-login,
.client-area {
  max-width: 860px;
  margin-bottom: var(--space-7);
  padding: var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.portal-login {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(260px, 0.5fr);
  gap: var(--space-7);
  align-items: start;
}

.portal-login p {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: var(--space-2);
}

.login-form label {
  color: var(--muted-strong);
  font-size: 0.92rem;
  font-weight: var(--w-medium);
}

.login-form input {
  width: 100%;
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--bg);
}

.login-hint {
  margin: 0 0 var(--space-2);
  color: var(--muted);
  font-size: 0.88rem;
}

.login-form .button {
  margin-top: var(--space-2);
}

.form-error {
  margin: var(--space-1) 0 0;
  color: var(--error);
  font-size: 0.93rem;
  font-weight: var(--w-medium);
}

/* Client area */
.client-area-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-5);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
}

.client-area-header h2 {
  margin: 0;
  font-size: var(--step-2);
}

.portal-grid {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--border);
}

.portal-grid article {
  min-width: 0;
  padding: var(--space-5) 0;
  border-bottom: 1px solid var(--border);
}

.portal-grid h3 {
  font-size: var(--step-1);
}

.portal-grid p {
  margin-bottom: var(--space-3);
  color: var(--muted);
}

.empty-state {
  color: var(--muted);
  font-style: italic;
}

.invoice-list {
  display: grid;
  gap: var(--space-3);
  margin: 0 0 var(--space-4);
}

.invoice-list div {
  display: grid;
  grid-template-columns: minmax(160px, 0.32fr) minmax(0, 1fr);
  gap: var(--space-4);
}

.invoice-list dt {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: var(--w-medium);
}

.invoice-list dd {
  margin: 0;
  color: var(--muted-strong);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
}

.footer-simple {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  color: var(--muted);
  font-size: 0.95rem;
}

/* Responsive */
@media (max-width: 760px) {
  .shell {
    width: min(calc(100% - 32px), var(--shell));
  }

  .nav,
  .footer-simple {
    min-height: auto;
    padding: var(--space-4) 0;
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-actions {
    width: 100%;
    justify-content: space-between;
    gap: var(--space-4);
  }

  .hero {
    padding: var(--space-8) 0;
  }

  .button-row {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-4);
  }

  .button-row .button {
    width: 100%;
  }

  .button-row .text-link,
  .button-row .quiet-link {
    justify-content: center;
  }

  .editorial-section,
  .how-section,
  .portal-preview,
  .closing {
    padding: var(--space-8) 0;
  }

  .text-rows article {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }

  .row-number {
    margin-bottom: var(--space-1);
  }

  .how-list,
  .portal-preview {
    grid-template-columns: 1fr;
  }

  .portal-main {
    padding: var(--space-7) 0 var(--space-8);
  }

  .portal-login {
    grid-template-columns: 1fr;
    gap: var(--space-5);
    padding: var(--space-5);
  }

  .client-area {
    padding: var(--space-5);
  }

  .client-area-header {
    flex-direction: column;
  }

  .invoice-list div {
    grid-template-columns: 1fr;
    gap: var(--space-1);
  }
}

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