/* ==========================================================================
   Kikomedy Studio — kikomedystudio.ch
   Light brand system: Creme-Grund, Ink-Typo, Akzente NUR als Flächen.
   Fraunces (Display) + Inter (Text), self-hosted. Alle Farben leben hier
   als Tokens — keine Hex-Werte im Markup.
   HARTE REGEL: lime/yellow/coral (1.28–1.91:1 auf Creme) tragen nie Text,
   nie Icons, nie bedeutungstragende Rahmen — nur gefüllte Flächen mit
   schwarzem Text (10–15:1).
   ========================================================================== */

/* ---- Fonts (variable, latin subset, self-hosted) ------------------------- */
@font-face {
  font-family: 'Fraunces';
  src: url('/assets/fonts/fraunces-var-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter-var-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---- Design tokens ------------------------------------------------------- */
:root {
  --bg: #FFF8EE;        /* Creme — Grund beider Marken-Assets */
  --surface: #FFFCF5;   /* Karten/Bänder, minimal heller als der Grund */
  --line: #D8CDBC;      /* warme Haarlinie — 1.49:1, Dimm-Test-fest */
  --ink: #000000;
  --ink-2: #3B3736;     /* sekundär, Crescent-Ton */
  --muted: #6B6B6B;     /* 5.05:1 auf Creme */
  --lime: #B2F05D;      /* Akzente: NUR Flächen, nie Text/Icon/Rahmen */
  --yellow: #F1D72C;
  --coral: #FE9D8A;
  --lime-deep: #A4E64C; /* Hover-Stufe der Lime-Fläche */

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-text: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --w-content: 1080px;
  --pad-x: clamp(20px, 5vw, 48px);
  --radius: 10px;
  /* Pixel-Raster: Banner-Massstab 39px/1500px ≈ 2.6 % — 24px Desktop,
     per clamp auf Mobile runter. Eine Kantenlänge für alles.
     Statischer Fallback zuerst: altes Safari ohne clamp() bekommt 20px. */
  --cell: 20px;
  color-scheme: light;
}
@supports (width: clamp(12px, 2.6vw, 24px)) {
  :root { --cell: clamp(12px, 2.6vw, 24px); }
}

/* ---- Reset / base -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--lime); color: var(--ink); }

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

a { color: inherit; }

header, main, footer { position: relative; z-index: 1; }

/* ---- Accessibility helpers ----------------------------------------------- */
.skip-link {
  position: absolute;
  top: -48px;
  left: 16px;
  z-index: 200;
  background: var(--lime);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 0 0 var(--radius) var(--radius);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* Fokus ist bedeutungstragend → immer ink, nie Akzent. */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ---- Pixel-System --------------------------------------------------------- */
/* Ein Raster, drei Farben, feste Kantenlänge (--cell). Deterministisch
   gesetzte Cluster als inline-SVG (aria-hidden); Zellfarben über Klassen. */
.pc-lime   { fill: var(--lime); }
.pc-yellow { fill: var(--yellow); }
.pc-coral  { fill: var(--coral); }
.pc-ink    { fill: var(--ink); }

.px { display: block; shape-rendering: crispEdges; }
.px rect { opacity: 1; }

/* Hero-Dekoration: zwei Eck-Cluster in fix dimensionierten, absolut
   positionierten Containern — kein Layout-Einfluss, CLS 0. */
.px-field { position: absolute; inset: 0; pointer-events: none; }
/* Unter der fixen Nav ansetzen — die Nav ist bis zum Scroll transparent. */
.px-tr { position: absolute; top: clamp(76px, 9vh, 96px); right: 0; width: calc(var(--cell) * 5); height: auto; }
.px-bl { position: absolute; bottom: 0; left: 0; width: calc(var(--cell) * 4); height: auto; }

/* Einmaliger, gestaffelter Aufbau beim Laden (nur die Dekoration bewegt
   sich — der Hero-Text bleibt animationsfrei, LCP unangetastet). */
.px-hero rect {
  opacity: 0;
  transform: scale(0.6);
  transform-box: fill-box;
  transform-origin: center;
  animation: pxin 0.22s ease-out forwards;
}
.px-hero rect:nth-child(1)  { animation-delay: 0.00s; }
.px-hero rect:nth-child(2)  { animation-delay: 0.04s; }
.px-hero rect:nth-child(3)  { animation-delay: 0.08s; }
.px-hero rect:nth-child(4)  { animation-delay: 0.12s; }
.px-hero rect:nth-child(5)  { animation-delay: 0.16s; }
.px-hero rect:nth-child(6)  { animation-delay: 0.20s; }
.px-hero rect:nth-child(7)  { animation-delay: 0.24s; }
.px-hero rect:nth-child(8)  { animation-delay: 0.28s; }
@keyframes pxin {
  to { opacity: 1; transform: none; }
}
/* Altes Safari ohne transform-box: Dekoration statisch, Wink aus —
   lieber ruhig als mit falschem Pivot. */
@supports not (transform-box: fill-box) {
  .px-hero rect { opacity: 1; transform: none; animation: none; }
  .nav-mark .crescent { animation: none !important; }
}

/* Kicker-Strip: drei kleine Zellen ersetzen den Strich. */
.kicker .px { width: calc(var(--cell) * 1.5); flex: none; }

/* ---- Nav ------------------------------------------------------------------ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px var(--pad-x);
  border-bottom: 1px solid transparent;
  transition: background 0.3s, border-color 0.3s;
}
.nav.scrolled {
  background-color: rgba(255, 248, 238, 0.92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-color: var(--line);
}
.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.01em;
  text-decoration: none;
}
.nav-brand span { color: var(--muted); font-weight: 400; }
.nav-mark { width: 28px; height: 28px; flex: none; }
.nav-mark .ring { fill: var(--ink); }
.nav-mark .crescent {
  fill: var(--ink-2);
  transform-origin: 50% 58%;
  transform-box: fill-box;
  animation: wink 0.6s ease-out 0.25s 1;
}
.nav-brand:hover .nav-mark .crescent,
.nav-brand:focus-visible .nav-mark .crescent {
  animation: wink 0.5s ease-out;
}
@keyframes wink {
  0%, 100% { transform: scaleY(1); }
  45% { transform: scaleY(0.12); }
}
.nav-links { display: flex; align-items: center; gap: clamp(14px, 3vw, 28px); }
.nav-links a {
  font-size: 13.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--ink); }
.nav-links .nav-cta {
  color: var(--ink);
  border: 1px solid var(--ink);
  padding: 7px 14px;
  border-radius: 999px;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.nav-links .nav-cta:hover { background: var(--ink); color: var(--bg); }

/* ---- Shared section chrome ------------------------------------------------ */
.section {
  max-width: var(--w-content);
  margin: 0 auto;
  padding: clamp(72px, 12vh, 128px) var(--pad-x);
}
.section-head { margin-bottom: clamp(36px, 6vw, 64px); }
.kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 18px;
}
.section-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(28px, 4.4vw, 44px);
  line-height: 1.12;
  letter-spacing: -0.01em;
  max-width: 640px;
}
.section-intro { color: var(--muted); max-width: 560px; margin-top: 16px; }

/* ---- Hero ----------------------------------------------------------------- */
.hero {
  position: relative;
  max-width: var(--w-content);
  margin: 0 auto;
  padding: clamp(140px, 22vh, 210px) var(--pad-x) clamp(72px, 12vh, 120px);
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  margin-bottom: 34px;
  background: var(--surface);
}
.hero-eyebrow::before {
  content: '';
  width: 8px; height: 8px;
  background: var(--lime); /* Fläche, dekorativ */
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 460;
  font-size: clamp(40px, 7.6vw, 78px);
  line-height: 1.08;
  letter-spacing: -0.015em;
  max-width: 820px;
  text-wrap: balance;
}
/* Akzent im Titel als Marker-FLÄCHE mit Ink-Text (15.5:1), nie als Textfarbe. */
.hero h1 em {
  font-style: normal;
  background: var(--lime);
  padding: 0 0.12em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.hero-sub {
  color: var(--muted);
  font-size: clamp(16px, 1.9vw, 18px);
  max-width: 560px;
  margin-top: 28px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  margin-top: 44px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: 0.02em;
  text-decoration: none;
  border-radius: 999px;
  padding: 14px 26px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.btn-primary { background: var(--lime); color: var(--ink); }
.btn-primary:hover { background: var(--lime-deep); }
.btn-ghost { color: var(--ink); border: 1px solid var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--bg); }
.btn .arrow { transition: transform 0.2s; }
.btn:hover .arrow { transform: translateX(3px); }

/* ---- Services ------------------------------------------------------------- */
.service-list { border-top: 1px solid var(--line); }
.service-row {
  display: grid;
  grid-template-columns: 72px 260px 1fr;
  gap: 24px;
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.service-num {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--ink-2);
}
.service-title {
  font-family: var(--font-display);
  font-weight: 560;
  font-size: clamp(20px, 2.4vw, 24px);
  letter-spacing: -0.005em;
}
.service-row:hover .service-title { text-decoration: underline; text-decoration-color: var(--ink-2); text-underline-offset: 5px; }
.service-desc { color: var(--muted); font-size: 15px; max-width: 560px; }

/* ---- Work ----------------------------------------------------------------- */
.work-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(16px, 2.4vw, 24px);
}
@media (min-width: 720px) {
  .work-grid { grid-template-columns: repeat(2, 1fr); }
  .work-card:last-child:nth-child(odd) { grid-column: span 2; }
}
.work-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.25s;
}
.work-card.is-link:hover { border-color: var(--ink-2); }

/* Karten-Tints: eine Akzentfarbe pro Karte, gesetzt als Token — Zuordnung
   (Enrico 13.8.): Play RPS lime · Moonshot yellow · Pocket Nation coral ·
   Cookbuk ink. */
.work-card[data-tint='lime']   { --tint: var(--lime); }
.work-card[data-tint='yellow'] { --tint: var(--yellow); }
.work-card[data-tint='coral']  { --tint: var(--coral); }
.work-card[data-tint='ink']    { --tint: var(--ink); }

.work-visual {
  position: relative;
  aspect-ratio: 16 / 9.5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
@supports not (aspect-ratio: 1) {
  .work-visual { min-height: 210px; }
}
/* Pixel-Cluster der Karte: Akzentfläche, hebt sich auf Hover an. */
.work-visual .px {
  position: absolute;
  left: 0; bottom: 0;
  width: calc(var(--cell) * 3);
  opacity: 0.55;
  transition: opacity 0.25s;
}
.work-visual .px rect { fill: var(--tint); }
.work-card:hover .work-visual .px,
.work-card:focus-within .work-visual .px { opacity: 1; }
.work-visual .wordmark {
  font-family: var(--font-display);
  font-weight: 480;
  font-size: clamp(26px, 3.4vw, 34px);
  letter-spacing: 0.01em;
  color: var(--ink);
}
.status {
  position: absolute;
  top: 14px; right: 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
}
.status.live,
.status.shipped { background: var(--lime); border-color: var(--lime); }

.work-body { display: flex; flex-direction: column; gap: 10px; padding: 22px 22px 24px; flex: 1; }
.work-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.work-title {
  font-family: var(--font-display);
  font-weight: 560;
  font-size: 21px;
}
.work-title a { text-decoration: none; }
.work-title a::after { content: ''; position: absolute; inset: 0; }
.work-arrow { color: var(--ink-2); flex: none; transition: transform 0.25s; }
.work-card.is-link:hover .work-arrow { transform: translate(3px, -3px); }
.work-desc { color: var(--muted); font-size: 14.5px; flex: 1; }
.work-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; list-style: none; }
.tag {
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--surface);
}
.work-note { color: var(--muted); font-size: 13px; margin-top: clamp(20px, 3vw, 28px); }

/* ---- Contact --------------------------------------------------------------- */
.contact {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.contact .section-title { max-width: 720px; }
.contact-mail {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(22px, 4.6vw, 40px);
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 6px;
  margin-top: 30px;
  transition: background 0.2s;
  overflow-wrap: anywhere;
}
.contact-mail:hover { background: var(--lime); }
.contact-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }
/* Copy-Button ist JS-only — ohne JS wäre er ein toter Knopf. */
html:not(.js) #copy-mail { display: none; }
.contact-meta { color: var(--muted); font-size: 13.5px; margin-top: 34px; }

/* ---- Footer ---------------------------------------------------------------- */
.footer {
  max-width: var(--w-content);
  margin: 0 auto;
  padding: 34px var(--pad-x) 42px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 13.5px;
}
.footer a { color: var(--muted); text-decoration: none; transition: color 0.2s; }
.footer a:hover { color: var(--ink); }
.footer-brand { font-family: var(--font-display); font-weight: 600; color: var(--ink); }

/* ---- Subpages (Impressum / Datenschutz) ------------------------------------ */
.subpage .section.prose { padding-top: clamp(120px, 18vh, 170px); max-width: 780px; }
.prose h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(32px, 5vw, 48px);
  letter-spacing: -0.01em;
  margin-bottom: 28px;
}
.prose h2 {
  font-family: var(--font-display);
  font-weight: 560;
  font-size: 20px;
  margin: 34px 0 10px;
}
.prose p, .prose li { color: var(--ink-2); font-size: 15.5px; }
.prose ul { list-style: none; padding-left: 0; }
.prose li { margin: 6px 0; padding-left: 18px; position: relative; }
/* Aufzählungsmarker im Pixel-Raster: kleines Ink-Quadrat. */
.prose li::before {
  content: '';
  position: absolute;
  left: 0; top: 0.62em;
  width: 8px; height: 8px;
  background: var(--ink);
}
.prose a { color: var(--ink); text-decoration-color: var(--ink-2); }
.prose a:hover { background: var(--lime); }
.prose-lead { font-size: 17px !important; max-width: 620px; }
.prose-meta { margin-top: 40px; font-size: 13.5px !important; color: var(--muted) !important; }

/* ---- Reveal on scroll (unter dem Fold; Hero bleibt animationsfrei) --------- */
html.js .reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
html.js .reveal.in { opacity: 1; transform: none; }

/* ---- Reduced motion: alles vollständig aus --------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html.js .reveal { opacity: 1; transform: none; }
  .px-hero rect { opacity: 1; transform: none; animation: none; }
  .nav-mark .crescent { animation: none !important; }
}

/* ---- Responsive ------------------------------------------------------------ */
@media (max-width: 760px) {
  .service-row { grid-template-columns: 44px 1fr; }
  .service-desc { grid-column: 2; }
}
@media (max-width: 420px) {
  .hero-actions .btn { width: 100%; justify-content: center; }
  .nav-links a:not(.nav-cta) { display: none; }
}
