/*
 * Katamatics Design System
 * Shared stylesheet for all Katamatics pages.
 * Requires tokens.css (the type families) to be loaded in the page <head>.
 * Page-specific layout styles live in each template's <style> block.
 */

/* ─── Reset ─────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ─── Design Tokens ─────────────────────────────────────── */

:root {
  --ink:         #1a1a18;
  --ink-mid:     #4a4a45;
  --ink-light:   #8a8a82;
  --paper:       #f5f3ee;
  --paper-bright:#ffffff;
  --red:         #c8291a;
  --rule:        rgba(26,26,24,0.12);
  --rule-light:  rgba(26,26,24,0.06);
}

/* ─── Base ───────────────────────────────────────────────── */

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-text);
  background: var(--paper-bright);
  color: var(--ink);
  font-size: var(--fs-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Texture ────────────────────────────────────────────── */

/* Apply to any section or body that should sit on paper */
.texture-bg {
  position: relative;
  background: var(--paper);
}

.texture-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 55px,
    rgba(26,26,24,0.035) 55px,
    rgba(26,26,24,0.035) 56px
  );
  mask-image: linear-gradient(
    to bottom,
    rgba(0,0,0,0.3) 0%,
    rgba(0,0,0,0.7) 40%,
    rgba(0,0,0,0.2) 100%
  );
  pointer-events: none;
  z-index: 0;
}

/* ─── Navigation ─────────────────────────────────────────── */

nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
  height: 72px;
  background: rgba(245,243,238,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 0.5px solid var(--rule);
}

.nav-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
}

/* Red-top-of-i logo treatment */
.logo-i {
  display: inline-block;
  line-height: 1;
  background: linear-gradient(to bottom, var(--red) 0 32%, currentColor 32% 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Standard nav link group */
.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav-links a {
  font-family: var(--font-tech);
  font-size: var(--fs-tech);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-tech);
  line-height: 1.2;
  color: var(--ink-mid);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--ink); }

/* Login / account link — stronger weight */
.nav-login {
  font-family: var(--font-tech);
  font-size: var(--fs-tech);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-tech);
  line-height: 1.2;
  color: var(--ink);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-login:hover { color: var(--red); }

/* Signed-in email display in nav */
.nav-email {
  font-size: var(--fs-small);
  font-weight: 400;
  color: var(--ink-light);
}

/* CTA button in nav */
.nav-cta {
  background: var(--ink);
  color: var(--paper-bright) !important;
  padding: 10px 24px;
  border-radius: 4px;
  transition: background 0.2s, transform 0.2s;
}
.nav-cta:hover {
  background: var(--red) !important;
  transform: translateY(-1px);
}

/* ─── Typography ─────────────────────────────────────────── */

/* Eyebrow / section label */
.section-label {
  font-family: var(--font-tech);
  font-size: var(--fs-tech);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-tech);
  line-height: 1.2;
  color: var(--red);
  margin-bottom: 16px;
  display: block;
}

/* Base headlines — pages override font-size and margin as needed */
h1, h2 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: var(--tracking-display);
  line-height: 1.1;
  color: var(--ink);
}

/* Red italic emphasis word inside headlines — one word maximum */
h1 em, h2 em {
  font-style: italic;
  font-weight: 500;
  color: var(--red);
  letter-spacing: var(--tracking-display);
}

/* Lead paragraph */
p.lead {
  font-size: var(--fs-lead);
  font-weight: 400;
  color: var(--ink-mid);
  line-height: 1.6;
}

/* ─── Buttons ────────────────────────────────────────────── */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: var(--paper-bright);
  font-family: var(--font-tech);
  font-size: var(--fs-tech);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-tech);
  line-height: 1.2;
  padding: 14px 32px;
  border: none;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.btn-primary:hover:not(:disabled) {
  background: var(--red);
  transform: translateY(-2px);
}
.btn-primary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-tech);
  font-size: var(--fs-tech);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-tech);
  line-height: 1.2;
  padding: 12px 24px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.btn-secondary:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.btn-ghost {
  display: block;
  text-align: center;
  color: var(--ink-mid);
  font-family: var(--font-tech);
  font-size: var(--fs-tech);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-tech);
  line-height: 1.2;
  text-decoration: none;
  transition: color 0.2s;
}
.btn-ghost:hover { color: var(--red); }

/* ─── Forms ──────────────────────────────────────────────── */

.form-group { margin-bottom: 32px; }

.form-label {
  display: block;
  font-family: var(--font-tech);
  font-size: var(--fs-tech);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-tech);
  line-height: 1.2;
  color: var(--ink-mid);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 14px 18px;
  border: 0.5px solid var(--rule);
  border-radius: 4px;
  font-size: var(--fs-body);
  font-family: var(--font-text);
  font-weight: 400;
  color: var(--ink);
  background: var(--paper-bright);
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}
.form-input:focus { border-color: var(--ink); }
.form-input::placeholder { color: var(--ink-light); font-weight: 400; }
.form-input.error { border-color: var(--red); }

/* ─── Modals / Overlays ──────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,26,24,0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-content {
  background: var(--paper-bright);
  width: 100%;
  max-width: 600px;
  padding: 48px;
  position: relative;
  border-radius: 4px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.1);
  max-height: 90vh;
  overflow-y: auto;
}

/* ─── Utility ────────────────────────────────────────────── */

.hidden { display: none !important; }

/* ─── Responsive ─────────────────────────────────────────── */

@media (max-width: 900px) {
  nav { padding: 0 24px; }
  .nav-email { display: none; }
}
