/* ==========================================================================
   HandwerkerOS — main.css
   Design tokens, base styles, layout, typography
   ========================================================================== */

/* -----------------------------
   Local Fonts (placeholder paths)
   Drop .woff2 files into /assets/fonts/ and they will be picked up.
   ----------------------------- */
@font-face {
  font-family: "Jakarta";
  src: local("Plus Jakarta Sans"),
       url("../fonts/PlusJakartaSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Jakarta";
  src: local("Plus Jakarta Sans Medium"),
       url("../fonts/PlusJakartaSans-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Jakarta";
  src: local("Plus Jakarta Sans SemiBold"),
       url("../fonts/PlusJakartaSans-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Jakarta";
  src: local("Plus Jakarta Sans Bold"),
       url("../fonts/PlusJakartaSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Jakarta";
  src: local("Plus Jakarta Sans ExtraBold"),
       url("../fonts/PlusJakartaSans-ExtraBold.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* -----------------------------
   Design Tokens
   ----------------------------- */
:root {
  /* Brand colors */
  --color-gold: #c8ac65;
  --color-gold-deep: #b3964e;
  --color-gold-soft: #e3d3a8;
  --color-anthracite: #433f3d;
  --color-anthracite-deep: #2f2c2a;
  --color-anthracite-soft: #5a5552;
  --color-white: #ffffff;
  --color-bg: #f7f5f1;
  --color-bg-deep: #efece5;
  --color-border: #e6e0d7;
  --color-border-strong: #d4ccbc;
  --color-text: #2f2c2a;
  --color-text-muted: #6b6663;
  --color-text-soft: #8a847f;

  /* Type system */
  --font-sans: "Jakarta", "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Jakarta", "Manrope", system-ui, -apple-system, sans-serif;

  --fs-eyebrow: 0.75rem;
  --fs-small: 0.875rem;
  --fs-body: 1.0625rem;
  --fs-lead: 1.1875rem;
  --fs-h4: 1.25rem;
  --fs-h3: 1.5rem;
  --fs-h2: clamp(1.75rem, 1.2rem + 2.4vw, 2.75rem);
  --fs-h1: clamp(2.25rem, 1.5rem + 3.6vw, 4rem);
  --fs-display: clamp(2.5rem, 1.6rem + 4.4vw, 4.75rem);

  --lh-tight: 1.05;
  --lh-snug: 1.2;
  --lh-base: 1.6;
  --lh-relaxed: 1.7;

  --tracking-tight: -0.02em;
  --tracking-base: 0;
  --tracking-wide: 0.02em;
  --tracking-caps: 0.18em;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-pill: 999px;

  /* Shadows — soft, warm, never glow-y */
  --shadow-xs: 0 1px 2px rgba(67, 63, 61, 0.04);
  --shadow-sm: 0 2px 6px rgba(67, 63, 61, 0.06), 0 1px 2px rgba(67, 63, 61, 0.04);
  --shadow-md: 0 8px 24px rgba(67, 63, 61, 0.08), 0 2px 6px rgba(67, 63, 61, 0.05);
  --shadow-lg: 0 24px 60px rgba(67, 63, 61, 0.12), 0 6px 16px rgba(67, 63, 61, 0.06);
  --shadow-inset: inset 0 0 0 1px var(--color-border);

  /* Layout */
  --container: 1200px;
  --container-narrow: 880px;
  --nav-height: 100px;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 180ms;
  --duration-base: 280ms;
  --duration-slow: 520ms;
}

/* -----------------------------
   Reset + Base
   ----------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 16px);
  overflow-x: clip;
}

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  background-image:
    radial-gradient(circle at 10% 0%, rgba(200, 172, 101, 0.05), transparent 40%),
    radial-gradient(circle at 90% 100%, rgba(67, 63, 61, 0.04), transparent 40%);
  background-attachment: fixed;
  /* overflow-x clipping handled by html { overflow-x: clip; } — keeping body free preserves position:sticky for the nav */
}

img, svg, video { max-width: 100%; height: auto; display: block; }

a {
  color: var(--color-anthracite-deep);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}
a:hover { color: var(--color-gold-deep); }

button { font-family: inherit; cursor: pointer; }

ul, ol { padding: 0; margin: 0; }
li { list-style: none; }

::selection {
  background: var(--color-gold);
  color: var(--color-anthracite-deep);
}

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

/* -----------------------------
   Typography
   ----------------------------- */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: var(--color-anthracite-deep);
  line-height: var(--lh-tight);
}

h1 { font-size: var(--fs-h1); font-weight: 800; }
h2 { font-size: var(--fs-h2); font-weight: 700; line-height: var(--lh-snug); }
h3 { font-size: var(--fs-h3); font-weight: 600; line-height: var(--lh-snug); }
h4 { font-size: var(--fs-h4); font-weight: 600; }

p { margin: 0; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-gold-deep);
}
.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--color-gold);
}

.lead {
  font-size: var(--fs-lead);
  line-height: var(--lh-relaxed);
  color: var(--color-text-muted);
}

.text-muted { color: var(--color-text-muted); }
.text-on-dark { color: var(--color-bg); }
.text-gold { color: var(--color-gold); }

/* Gold underline accent for headlines */
.accent-underline {
  position: relative;
  display: inline-block;
}
.accent-underline::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -8px;
  width: 64px;
  height: 4px;
  background: var(--color-gold);
  border-radius: 2px;
}

/* -----------------------------
   Layout
   ----------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}
.container--narrow { max-width: var(--container-narrow); }

section {
  padding-block: clamp(4rem, 8vw, 7rem);
  position: relative;
}
section.section--tight { padding-block: clamp(3rem, 5vw, 5rem); }

/* Section header pattern */
.section-head {
  max-width: 760px;
  margin-bottom: clamp(2.5rem, 4vw, 4rem);
}
.section-head--center {
  margin-inline: auto;
  text-align: center;
}
.section-head--center .eyebrow { justify-content: center; }
.section-head .lead { margin-top: var(--space-5); }

/* -----------------------------
   Surfaces
   ----------------------------- */
.section--cream { background: var(--color-bg); }
.section--paper { background: var(--color-white); }
.section--dark {
  background: var(--color-anthracite);
  color: var(--color-bg);
  background-image:
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.012) 0,
      rgba(255, 255, 255, 0.012) 1px,
      transparent 1px,
      transparent 12px
    );
}
.section--dark h1, .section--dark h2, .section--dark h3, .section--dark h4 {
  color: #f6f1e6;
}
.section--dark .lead, .section--dark .text-muted { color: #c2bdb6; }
.section--dark .eyebrow { color: var(--color-gold); }
.section--dark .eyebrow::before { background: var(--color-gold); }

.section--gold {
  background: var(--color-gold);
  color: var(--color-anthracite-deep);
}
.section--gold h1, .section--gold h2, .section--gold h3 { color: var(--color-anthracite-deep); }
.section--gold .eyebrow { color: var(--color-anthracite-deep); }
.section--gold .eyebrow::before { background: var(--color-anthracite-deep); }

/* Subtle hexagonal grid background — used sparingly */
.bg-hex {
  position: relative;
}
.bg-hex::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='84' height='96' viewBox='0 0 84 96'><path d='M42 1 L82 24 L82 72 L42 95 L2 72 L2 24 Z' fill='none' stroke='%23433f3d' stroke-width='1' opacity='0.045'/></svg>");
  background-size: 84px 96px;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse at 50% 50%, #000 30%, transparent 78%);
          mask-image: radial-gradient(ellipse at 50% 50%, #000 30%, transparent 78%);
}

/* -----------------------------
   Grids
   ----------------------------- */
.grid { display: grid; gap: var(--space-8); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 960px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .grid-2-mobile-keep { grid-template-columns: 1fr 1fr; gap: var(--space-4); }
}

/* -----------------------------
   Utility
   ----------------------------- */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mt-10 { margin-top: var(--space-10); }

.text-center { text-align: center; }
.no-wrap { white-space: nowrap; }

.placeholder-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-text-soft);
  background: var(--color-border);
  border-radius: var(--radius-pill);
}
.placeholder-tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-gold);
}

/* skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-anthracite-deep);
  color: var(--color-bg);
  padding: var(--space-3) var(--space-5);
  z-index: 9999;
  border-radius: 0 0 var(--radius-md) 0;
}
.skip-link:focus {
  left: 0;
  color: var(--color-bg);
}
