/*
 * KRM Creative, the agency's own site.
 *
 * Built with the Demo Factory build stack: the emilkowalski motion and
 * mobile rules (transform and opacity only, strong curves, UI under 300ms,
 * press feedback, hover only where a pointer can hover, reduced motion
 * gentler not none), impeccable, and taste-skill (one accent, one radius,
 * one theme, two eyebrows on the whole page, no filler).
 *
 * Tokens first; nothing below the token block names a raw colour.
 */

:root {
  --c-bg: #F3F1EC;          /* the cream behind the wordmark */
  --c-surface: #FFFFFF;
  --c-tint: #E9E6DE;
  --c-ink: #1C1A17;         /* the wordmark's ink, 15.4:1 on the cream */
  --c-muted: #5A564F;       /* 6.5:1 on the cream */
  --c-line: #DAD6CC;
  --c-line-strong: #A9A498;
  --c-accent: #1F3FCC;      /* cobalt, 7.9:1 with white, 7.0:1 on the cream */
  --c-on-accent: #FFFFFF;
  --c-focus: #1F3FCC;

  --font: "Geist", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --t-hero: clamp(2.5rem, 1.4rem + 3.8vw, 4.4rem);
  --t-h2: clamp(1.9rem, 1.3rem + 2vw, 3rem);
  --t-h3: clamp(1.2rem, 1.1rem + 0.4vw, 1.5rem);
  --t-lede: clamp(1.125rem, 1.05rem + 0.35vw, 1.3rem);
  --t-body: 1.0625rem;
  --t-small: 0.875rem;
  --t-num: clamp(3rem, 2rem + 4vw, 5.5rem);

  --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 72px;
  --space-section: clamp(64px, 10vw, 136px);
  --container: 1200px;
  --gutter: clamp(20px, 4vw, 40px);
  --radius: 6px;
  --radius-lg: 12px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --dur-press: 140ms;
  --dur-ui: 200ms;
  --dur-reveal: 480ms;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; scroll-behavior: smooth; scroll-padding-top: 88px; }
body { margin: 0; background: var(--c-bg); color: var(--c-ink); font-family: var(--font); font-size: var(--t-body); line-height: 1.6; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, p, ul, ol, figure, address { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
address { font-style: normal; }
:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 3px; border-radius: 2px; }

/* Controls: no double-tap wait, no long-press selection. Content text stays selectable. */
button, .btn, .text-link, .nav a { touch-action: manipulation; }
button, .btn, .nav-toggle { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

.skip { position: absolute; left: 16px; top: -80px; z-index: 50; background: var(--c-ink); color: var(--c-bg); padding: 12px 18px; border-radius: var(--radius); text-decoration: none; font-weight: 600; }
.skip:focus { top: 12px; }
.hidden-field[hidden] { display: none; }

.container { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }
section { padding-block: var(--space-section); }

/* ---------- type ---------- */
h1, h2, h3 { font-weight: 600; letter-spacing: -0.025em; line-height: 1.06; text-wrap: balance; }
h1 { font-size: var(--t-hero); overflow-wrap: anywhere; }
h2 { font-size: var(--t-h2); line-height: 1.1; }
h3 { font-size: var(--t-h3); line-height: 1.25; letter-spacing: -0.01em; }
p { text-wrap: pretty; }
.lede { font-size: var(--t-lede); line-height: 1.5; color: var(--c-muted); max-width: 34em; }
.eyebrow { display: block; font-family: var(--font-mono); font-size: var(--t-small); font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-accent); margin-bottom: var(--s-3); }
.section-head { max-width: 46rem; margin-bottom: var(--s-7); }
.section-head > * + * { margin-top: var(--s-4); }

/* ---------- buttons and links ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 12px 24px; border: 2px solid transparent; border-radius: var(--radius); font-weight: 600; font-size: 1.0625rem; line-height: 1.2; text-decoration: none; cursor: pointer; white-space: nowrap; transition: transform var(--dur-press) var(--ease-out), background-color 160ms ease, color 160ms ease, border-color 160ms ease; }
.btn:active, .nav-toggle:active { transform: scale(0.97); }
.btn--primary { background: var(--c-accent); color: var(--c-on-accent); }
.btn--secondary { background: transparent; color: var(--c-ink); border-color: var(--c-ink); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.text-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 600; color: var(--c-ink); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; transition: color 160ms ease; }
.text-link .icon { width: 18px; height: 18px; }

/* ---------- header ---------- */
.masthead { background: var(--c-bg); border-bottom: 1px solid var(--c-line); }
.masthead-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-5); min-height: 76px; padding-block: 12px; }
.brand { display: inline-flex; align-items: center; min-height: 44px; }
.brand img { width: clamp(150px, 18vw, 200px); height: auto; }
.nav ul { display: flex; align-items: center; gap: 4px var(--s-5); }
.nav a:not(.btn) { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; transition: border-color 160ms ease; }
.nav .btn { min-height: 46px; padding: 10px 20px; font-size: 1rem; }
.nav-toggle { display: none; }
@media (max-width: 899px) {
  .masthead-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 16px; min-height: 68px; }
  .js .nav-toggle { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 14px; background: transparent; border: 2px solid var(--c-ink); border-radius: var(--radius); font-weight: 600; cursor: pointer; transition: transform var(--dur-press) var(--ease-out); }
  .nav-toggle-lines { position: relative; width: 18px; height: 2px; background: currentColor; }
  .nav-toggle-lines::before, .nav-toggle-lines::after { content: ""; position: absolute; left: 0; width: 18px; height: 2px; background: currentColor; }
  .nav-toggle-lines::before { top: -6px; } .nav-toggle-lines::after { top: 6px; }
  .masthead .nav { grid-column: 1 / -1; }
  /* An occasional menu: one path in, the same path out, interruptible. Browsers without discrete display transitions just toggle. */
  .js .nav { display: none; opacity: 0; transform: translateY(-6px); transition: opacity var(--dur-ui) var(--ease-out), transform var(--dur-ui) var(--ease-out), display var(--dur-ui) allow-discrete; }
  .js .nav[data-open="true"] { display: block; opacity: 1; transform: none; }
  @starting-style { .js .nav[data-open="true"] { opacity: 0; transform: translateY(-6px); } }
  .nav ul { flex-direction: column; align-items: stretch; gap: 0; padding-bottom: 12px; }
  .nav li { border-top: 1px solid var(--c-line); }
  .nav a:not(.btn) { min-height: 52px; width: 100%; }
  .nav .btn { width: 100%; margin-top: 12px; }
}

/* ---------- hero: editorial. Headline and drawing above a rule, copy and tenets below it ---------- */
.hero { padding-block: clamp(40px, 6vw, 88px) clamp(48px, 7vw, 104px); overflow: hidden; }
.hero-layout { display: grid; gap: var(--s-6); grid-template-areas: "head" "rule" "copy" "mark"; }
.hero-head { grid-area: head; }
.hero-head h1 { max-width: 12em; font-size: max(2.4rem, min(var(--t-hero), 5vw)); }
.hero-rule { grid-area: rule; width: 100%; margin: 0; border: 0; border-top: 1px solid var(--c-line-strong); }
.hero-copy { grid-area: copy; }
.hero-copy > * + * { margin-top: var(--s-5); }
/* The drawing: the anatomy of a page that converts. A headline, one action, a route to the phone. Drawn once on load; still under reduced motion. */
.hero-mark { grid-area: mark; color: var(--c-accent); max-width: 300px; margin: 0; }
.hero-mark svg { width: 100%; height: auto; }
@media (min-width: 900px) {
  /* The hero fills the first screen below the masthead; its content sits in the vertical centre of it. */
  .hero { padding-block: clamp(40px, 5vw, 80px); min-height: calc(100svh - 77px); display: grid; align-content: center; }
  /* The illustration fills the right-hand area alongside the headline, copy and actions. */
  .hero-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto auto; grid-template-areas: "head mark" "rule mark" "copy mark"; column-gap: clamp(40px, 6vw, 96px); row-gap: var(--s-6); align-items: start; }
  .hero-head { align-self: end; }
  .hero-mark { position: relative; inset-inline-start: clamp(32px, calc((100vw - var(--container)) / 2 - 16px), 48px); justify-self: end; align-self: stretch; max-width: none; width: calc(100% + 32px); }
  .hero-mark svg { position: absolute; inset: 0; width: 100%; height: 100%; }
}
.js .anatomy-lines > * { stroke-dasharray: 1; stroke-dashoffset: 1; animation: mark-draw 900ms var(--ease-out) forwards; }
.js .anatomy-lines > :nth-child(2) { animation-delay: 120ms; }
.js .anatomy-lines > :nth-child(n + 3) { animation-delay: 240ms; }
.js .anatomy-fills > * { opacity: 0; animation: mark-fade 300ms var(--ease-out) 420ms forwards; }
.js .anatomy-fills > :nth-child(5) { animation-delay: 520ms; }
.js .anatomy-fills > :nth-child(6) { animation-delay: 620ms; }
.js .anatomy-route > * { stroke-dashoffset: 1; stroke-dasharray: 1; animation: mark-draw 500ms var(--ease-out) 800ms forwards; }
.js .anatomy-route > :first-child { stroke-dasharray: 6 8; stroke-dashoffset: 0; opacity: 0; animation: mark-fade 400ms var(--ease-out) 800ms forwards; }
.js .anatomy-phone { opacity: 0; transform: scale(0.94); transform-origin: 416px 200px; animation: mark-arrive 400ms var(--ease-out) 1100ms forwards; }
/* The underline under the word that matters, drawn in after the headline has been read. */
.underlined { position: relative; display: inline-block; }
.underlined svg { position: absolute; left: -2%; top: 100%; width: 104%; height: 0.32em; color: var(--c-accent); overflow: visible; }
.js .underlined path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: mark-draw 700ms var(--ease-out) 300ms forwards; }
@keyframes mark-draw { to { stroke-dashoffset: 0; } }
@keyframes mark-fade { to { opacity: 1; } }
@keyframes mark-arrive { to { opacity: 1; transform: none; } }

/* A browser frame and a phone frame: the work, not a stock photograph. */
.device { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: 0 24px 60px -32px rgba(28, 26, 23, 0.35); }
.device--desktop { position: relative; padding-top: 28px; }
.device--desktop::before { content: ""; position: absolute; left: 12px; top: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--c-line-strong); box-shadow: 14px 0 0 var(--c-line-strong), 28px 0 0 var(--c-line-strong); }
.device--desktop img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; }
.device--phone { border-radius: 22px; padding: 8px; width: clamp(110px, 26%, 190px); }
.device--phone img { width: 100%; aspect-ratio: 600 / 1298; object-fit: cover; object-position: top; border-radius: 16px; }
.project-media { position: relative; padding-bottom: 8%; padding-right: 5%; }
.project-media .device--phone { position: absolute; right: 0; bottom: 0; }
@media (max-width: 899px) { .project-media .device--phone { width: 30%; } }

/* ---------- work ---------- */
.projects { display: grid; gap: clamp(56px, 8vw, 112px); }
.project { display: grid; gap: var(--s-6); }
.project-copy > * + * { margin-top: var(--s-3); }
.project-place { font-family: var(--font-mono); font-size: var(--t-small); color: var(--c-muted); }
.project-copy p:not(.project-place) { max-width: 30em; color: var(--c-muted); }
.project-copy h3 { font-size: clamp(1.5rem, 1.2rem + 1vw, 2.1rem); }
@media (min-width: 900px) {
  .project { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); column-gap: clamp(40px, 5vw, 72px); align-items: end; }
  .project--reverse .project-media { order: 2; }
  .project--reverse .project-copy { order: 1; }
}

/* ---------- how it works: numerals doing the work, no cards ---------- */
.how { background: var(--c-surface); border-block: 1px solid var(--c-line); }
.steps { display: grid; gap: var(--s-7) var(--s-8); }
.step { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px var(--s-5); align-items: start; }
.step-num { grid-row: span 2; font-family: var(--font-mono); font-size: var(--t-num); font-weight: 500; line-height: 0.85; letter-spacing: -0.04em; color: var(--c-tint); }
.step p { color: var(--c-muted); max-width: 34em; }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- what every site comes with ---------- */
.included { display: grid; gap: 14px var(--s-6); max-width: 60rem; }
.included li { position: relative; padding-left: 28px; color: var(--c-ink); }
.included li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 14px; height: 8px; border-left: 2px solid var(--c-accent); border-bottom: 2px solid var(--c-accent); transform: rotate(-45deg); }
@media (min-width: 760px) { .included { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- about ---------- */
.about { background: var(--c-ink); color: var(--c-bg); }
.about-grid { display: grid; gap: var(--s-6); grid-template-areas: "heading" "copy"; }
.about-grid > h2 { grid-area: heading; }
.about-copy { grid-area: copy; }
.about-copy > * + * { margin-top: var(--s-4); }
.about-copy p { max-width: 36em; color: #B9B4A8; }
@media (min-width: 900px) {
  .about-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-areas: "heading copy"; column-gap: clamp(32px, 4vw, 64px); align-items: start; }
}

/* ---------- contact ---------- */
.contact-grid { display: grid; gap: var(--s-7); }
.contact-copy > * + * { margin-top: var(--s-4); }
.contact-alt { color: var(--c-muted); }
.contact-alt a { color: var(--c-ink); font-weight: 600; text-underline-offset: 4px; }
@media (min-width: 900px) { .contact-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); column-gap: clamp(40px, 6vw, 96px); align-items: start; } }
.form { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius-lg); padding: clamp(24px, 4vw, 40px); display: grid; gap: var(--s-4); }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: 0.9375rem; }
.field .optional { font-weight: 400; color: var(--c-muted); }
.field input, .field textarea { width: 100%; min-height: 52px; padding: 12px 14px; font-size: max(1rem, 16px); background: var(--c-surface); border: 1.5px solid var(--c-line-strong); border-radius: var(--radius); transition: border-color 160ms ease; }
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; border-color: var(--c-ink); }
.form .btn { width: 100%; }
.form-note { font-size: var(--t-small); color: var(--c-muted); }

/* ---------- footer ---------- */
.site-footer { background: var(--c-surface); border-top: 1px solid var(--c-line); padding-block: var(--s-8) var(--s-6); font-size: 0.9375rem; }
.footer-grid { display: grid; gap: var(--s-6); grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.footer-mark { width: 178px; margin-bottom: var(--s-3); }
.footer-grid p { color: var(--c-muted); max-width: 24em; }
.footer-grid li a, .footer-grid address a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.footer-grid address { color: var(--c-muted); line-height: 1.7; }
.footer-base { margin-top: var(--s-7); padding-top: var(--s-5); border-top: 1px solid var(--c-line); color: var(--c-muted); font-size: 1rem; display: grid; gap: 8px; }

/* ---------- hover: only where a pointer can hover ---------- */
@media (hover: hover) and (pointer: fine) {
  .btn--primary:hover { background: var(--c-ink); color: var(--c-bg); }
  .btn--secondary:hover { background: var(--c-ink); color: var(--c-bg); }
  .text-link:hover { color: var(--c-accent); }
  .nav a:not(.btn):hover { border-bottom-color: var(--c-accent); }
  .footer-grid li a:hover, .footer-grid address a:hover, .contact-alt a:hover { text-decoration: underline; text-underline-offset: 4px; }
}

/* ---------- motion ---------- */
/* Reveal on scroll, once, on a page a visitor sees once. Transform and opacity only. */
.js [data-reveal].reveal { opacity: 0; transform: translateY(12px); transition: opacity var(--dur-reveal) var(--ease-out), transform var(--dur-reveal) var(--ease-out); }
.js [data-reveal].reveal.in { opacity: 1; transform: none; }
.js .reveal :is(.projects, .steps, .included) > * { opacity: 0; transform: translateY(8px); transition: opacity 300ms var(--ease-out), transform 300ms var(--ease-out); }
.js .reveal.in :is(.projects, .steps, .included) > * { opacity: 1; transform: none; }
.js .reveal.in :is(.projects, .steps, .included) > :nth-child(2) { transition-delay: 40ms; }
.js .reveal.in :is(.projects, .steps, .included) > :nth-child(3) { transition-delay: 80ms; }
.js .reveal.in :is(.projects, .steps, .included) > :nth-child(4) { transition-delay: 120ms; }
.js .reveal.in :is(.projects, .steps, .included) > :nth-child(n + 5) { transition-delay: 160ms; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal].reveal, .js .reveal :is(.projects, .steps, .included) > * { opacity: 1; transform: none; transition: none; }
  .btn:active, .nav-toggle:active { transform: none; }
  .js .anatomy-lines > *, .js .anatomy-fills > *, .js .anatomy-route > *, .js .anatomy-phone, .js .underlined path { animation: none; opacity: 1; stroke-dashoffset: 0; transform: none; }
  .js .anatomy-route > :first-child { stroke-dasharray: 6 8; }
  .js .nav { transform: none; transition: opacity 150ms ease, display 150ms allow-discrete; }
  @starting-style { .js .nav[data-open="true"] { transform: none; } }
}
/* Short viewports (a landscape phone, a 200% zoom window): the headline and the action stay in the first screen. */
@media (max-height: 640px) {
  .hero { padding-block-start: var(--s-5); }
  .hero-layout { gap: var(--s-4); }
  .hero-mark { display: none; }
  .hero-head h1 { font-size: 2rem; }
  .hero-copy > * + * { margin-top: var(--s-4); }
}
@media print { .nav-toggle, .skip { display: none !important; } }
