/* ==========================================================================
   Linsa — site styles
   Carries the approved "Galleri" design (see docs/design/design-notes.md).
   CSS-first, thin custom layer of tokens + layout + small components.
   Light is default; a dark "Studio" palette follows prefers-color-scheme.
   ========================================================================== */

:root {
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --maxw: 1160px;
  --radius: 14px;
  --shadow: 0 18px 50px -22px rgba(20, 16, 10, .45);

  /* Light "Galleri" (default) */
  --color-bg: #f7f4ef;
  --color-surface: #ffffff;
  --color-surface-2: #f0ebe2;
  --color-text: #1c1a17;
  --color-muted: #6f6a63;
  --color-border: #e6ded2;
  --color-accent: #a8542a;
  --color-accent-soft: #f2e2d6;
  --on-accent: #ffffff;

  color-scheme: light dark;
}

/* Dark "Studio" — follows the system preference (no visible toggle in first delivery). */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #121115;
    --color-surface: #1a191f;
    --color-surface-2: #201f26;
    --color-text: #f2efe9;
    --color-muted: #a7a29b;
    --color-border: #2b2933;
    --color-accent: #d9a441;
    --color-accent-soft: #33291a;
    --on-accent: #1a140a;
  }
}

/* Explicit override hook (kept for a future toggle; not used in first delivery). */
[data-theme="light"] {
  --color-bg: #f7f4ef; --color-surface: #ffffff; --color-surface-2: #f0ebe2;
  --color-text: #1c1a17; --color-muted: #6f6a63; --color-border: #e6ded2;
  --color-accent: #a8542a; --color-accent-soft: #f2e2d6; --on-accent: #ffffff;
}
[data-theme="dark"] {
  --color-bg: #121115; --color-surface: #1a191f; --color-surface-2: #201f26;
  --color-text: #f2efe9; --color-muted: #a7a29b; --color-border: #2b2933;
  --color-accent: #d9a441; --color-accent-soft: #33291a; --on-accent: #1a140a;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -.01em;
  margin: 0 0 .4em;
}

a { color: inherit; }
img { max-width: 100%; }
.muted { color: var(--color-muted); }
.accent { color: var(--color-accent); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-accent);
  color: var(--on-accent);
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: .96rem;
  padding: .72em 1.4em;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, background .2s ease, border-color .2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--color-accent); color: var(--on-accent); }
.btn-ghost { background: transparent; color: var(--color-text); border-color: var(--color-border); }
.btn-ghost:hover { border-color: var(--color-accent); }
.btn-block { width: 100%; justify-content: center; }

/* ---- Header ---- */
header.site {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: saturate(1.4) blur(10px);
  background: color-mix(in srgb, var(--color-bg) 82%, transparent);
  border-bottom: 1px solid var(--color-border);
}
.navrow { display: flex; align-items: center; justify-content: space-between; height: 70px; }
.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: .02em;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--color-accent); display: inline-block; margin-bottom: 6px; }
nav.main { display: flex; align-items: center; gap: 30px; }
nav.main a.link { text-decoration: none; font-size: .96rem; font-weight: 500; color: var(--color-muted); transition: color .2s; }
nav.main a.link:hover, nav.main a.link[aria-current="page"] { color: var(--color-text); }
nav.main a.link[aria-current="page"] { color: var(--color-accent); }
.tools { display: flex; align-items: center; gap: 14px; }

.navtoggle {
  display: none;
  width: 42px; height: 42px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* ---- Image helper ---- */
.photo {
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  display: block;
  background: var(--color-surface-2);
}

/* ---- Hero ---- */
.hero { padding: clamp(48px, 7vw, 96px) 0 clamp(40px, 5vw, 72px); }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(28px, 4vw, 60px); align-items: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: .74rem; font-weight: 600; color: var(--color-accent); margin-bottom: 20px; }
.hero h1 { font-size: clamp(2.6rem, 1.6rem + 4vw, 4.6rem); }
.hero p.lead { font-size: 1.16rem; color: var(--color-muted); max-width: 30em; margin: 0 0 32px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 34px; margin-top: 44px; }
.hero-stats .n { font-family: var(--font-display); font-size: 1.9rem; }
.hero-stats .l { font-size: .82rem; color: var(--color-muted); }
.hero-img { width: 100%; aspect-ratio: 4/5; box-shadow: var(--shadow); }

/* ---- Sections ---- */
section { padding: clamp(48px, 6vw, 88px) 0; }
.sec-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 34px; flex-wrap: wrap; }
.sec-head h2 { font-size: clamp(1.8rem, 1.3rem + 1.8vw, 2.7rem); }
.sec-head .sub { color: var(--color-muted); max-width: 34em; }
.seelink { text-decoration: none; color: var(--color-accent); font-weight: 600; white-space: nowrap; }

/* ---- Gallery grid (front-page teaser) ---- */
.gallery { display: grid; grid-template-columns: repeat(6, 1fr); grid-auto-rows: 150px; gap: 16px; }
.gallery a { display: block; grid-column: span 2; }
.gallery a.big { grid-column: span 3; grid-row: span 2; }
.gallery a.tall { grid-row: span 2; }
.gallery img { width: 100%; height: 100%; }

/* ---- Portfolio full grid ---- */
.grid-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-cols a { display: block; }
.grid-cols img { width: 100%; aspect-ratio: 4/5; }

/* ---- Services ---- */
.services { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.svc { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 26px 22px; transition: transform .18s ease, border-color .2s; }
.svc:hover { transform: translateY(-4px); border-color: var(--color-accent); }
.svc .ic { width: 42px; height: 42px; border-radius: 12px; background: var(--color-accent-soft); color: var(--color-accent); display: grid; place-items: center; margin-bottom: 16px; }
.svc h3 { font-size: 1.24rem; margin-bottom: 6px; }
.svc p { font-size: .92rem; color: var(--color-muted); margin: 0; }

/* ---- About ---- */
.about { background: var(--color-surface-2); }
.about-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(28px, 4vw, 56px); align-items: center; }
.about-img { width: 100%; aspect-ratio: 1/1; }
.about blockquote { font-family: var(--font-display); font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); line-height: 1.3; margin: 0 0 20px; }

/* ---- CTA band ---- */
.ctaband { text-align: center; }
.ctaband .inner { background: var(--color-accent); color: var(--on-accent); border-radius: 22px; padding: clamp(40px, 6vw, 72px) 24px; }
.ctaband h2 { font-size: clamp(1.9rem, 1.4rem + 2vw, 3rem); color: inherit; }
.ctaband p { max-width: 32em; margin: 0 auto 26px; opacity: .92; }
.ctaband .btn-primary { background: var(--color-surface); color: var(--color-accent); }

/* ---- Page intro (portfolio / om / kontakt) ---- */
.page-intro { padding: clamp(40px, 6vw, 80px) 0 clamp(20px, 3vw, 36px); }
.page-intro h1 { font-size: clamp(2.2rem, 1.6rem + 2.6vw, 3.6rem); }
.page-intro p { color: var(--color-muted); max-width: 40em; font-size: 1.08rem; }

/* ---- Contact ---- */
.contact-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(28px, 4vw, 56px); align-items: start; padding-bottom: clamp(48px, 6vw, 88px); }
.contact-aside h3 { font-size: 1.3rem; }
.contact-aside p { color: var(--color-muted); }
.contact-aside .line { margin: 6px 0; }
.star { color: var(--color-accent); }

/* ---- Forms ---- */
.form { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: clamp(22px, 3vw, 32px); }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 500; font-size: .92rem; margin-bottom: 7px; }
.field .req { color: var(--color-accent); }
.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="password"],
.field textarea {
  width: 100%;
  font: inherit;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: .7em .85em;
  transition: border-color .2s;
}
.field textarea { min-height: 140px; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--color-accent); outline: none; }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: #c0392b; }
.field .error { color: #c0392b; font-size: .84rem; margin-top: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { margin-top: .25em; }
.check label { font-weight: 400; color: var(--color-muted); font-size: .9rem; margin: 0; }
.form-note { font-size: .82rem; color: var(--color-muted); margin: 4px 0 18px; }
.form-error-summary { background: var(--color-accent-soft); color: var(--color-text); border-radius: 10px; padding: 12px 14px; margin-bottom: 18px; font-size: .9rem; }

.confirm { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: clamp(26px, 4vw, 40px); text-align: center; }
.confirm .badge { width: 56px; height: 56px; border-radius: 50%; background: var(--color-accent-soft); color: var(--color-accent); display: grid; place-items: center; margin: 0 auto 16px; }
.confirm h3 { font-size: 1.5rem; }
.confirm p { color: var(--color-muted); margin: 0; }

.htmx-request .btn[type="submit"] { opacity: .6; pointer-events: none; }

/* ---- Footer ---- */
footer.site { border-top: 1px solid var(--color-border); padding: 56px 0 30px; }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; margin-bottom: 40px; }
footer .brand { font-size: 1.3rem; margin-bottom: 10px; }
footer h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: var(--color-muted); margin: 0 0 14px; font-family: var(--font-body); font-weight: 600; }
footer .foot-links a { display: block; text-decoration: none; color: var(--color-text); margin-bottom: 9px; font-size: .94rem; }
footer .foot-links a:hover { color: var(--color-accent); }
.foot-contact .line { margin-bottom: 9px; font-size: .94rem; color: var(--color-text); }
.foot-bottom { display: flex; align-items: center; justify-content: space-between; padding-top: 22px; border-top: 1px solid var(--color-border); flex-wrap: wrap; gap: 14px; font-size: .86rem; color: var(--color-muted); }

/* ---- Gusto credit ---- */
.gusto-credit { display: inline-flex; align-items: center; gap: .45em; color: var(--color-muted); font-size: .8125rem; text-decoration: none; }
.gusto-credit a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: .45em; }
.gusto-credit__logo { display: inline-block; width: clamp(3.5rem, 12vw, 4.75rem); height: auto; }
.gusto-credit__text--short { display: none; }
@media (max-width: 360px) {
  .gusto-credit__text--standard { display: none; }
  .gusto-credit__text--short { display: inline; }
}

/* ---- Lightbox (portfolio) ---- */
dialog.lightbox { border: none; background: transparent; padding: 0; max-width: 92vw; max-height: 92vh; }
dialog.lightbox::backdrop { background: rgba(10, 8, 6, .82); }
dialog.lightbox img { max-width: 92vw; max-height: 82vh; border-radius: var(--radius); }
dialog.lightbox .close { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.5); color: #fff; border: none; border-radius: 50%; width: 40px; height: 40px; font-size: 1.4rem; cursor: pointer; }

/* ==========================================================================
   Admin
   ========================================================================== */
body.admin { background: var(--color-surface-2); }
.admin-header { border-bottom: 1px solid var(--color-border); background: var(--color-surface); }
.admin-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.admin-header .brand { font-size: 1.25rem; }
.admin-header nav { display: flex; align-items: center; gap: 16px; font-size: .92rem; }
.admin-main { padding: clamp(28px, 4vw, 48px) 0; }

.auth-card { max-width: 420px; margin: clamp(40px, 8vw, 96px) auto; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: clamp(26px, 4vw, 38px); }
.auth-card h1 { font-size: 1.7rem; }
.auth-card .sub { color: var(--color-muted); margin-top: -.2em; margin-bottom: 22px; }
.alert { background: var(--color-accent-soft); color: var(--color-text); border-radius: 10px; padding: 12px 14px; margin-bottom: 18px; font-size: .9rem; }
.alert-info { background: var(--color-surface-2); }

.stat-row { display: flex; gap: 22px; margin-bottom: 26px; flex-wrap: wrap; }
.stat { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 18px 22px; }
.stat .n { font-family: var(--font-display); font-size: 2rem; }
.stat .l { color: var(--color-muted); font-size: .84rem; }

.table-wrap { overflow-x: auto; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--color-border); vertical-align: top; }
table.data th { font-weight: 600; color: var(--color-muted); white-space: nowrap; }
table.data tr:last-child td { border-bottom: none; }
table.data td.msg { max-width: 420px; white-space: pre-wrap; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .76rem; background: var(--color-surface-2); border: 1px solid var(--color-border); }
.empty { padding: 40px; text-align: center; color: var(--color-muted); }
.section-title { margin: 34px 0 14px; font-size: 1.2rem; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 860px) {
  nav.main { display: none; }
  nav.main.open {
    display: flex;
    position: absolute;
    top: 70px; left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 10px 24px 18px;
  }
  nav.main.open a.link { padding: 12px 0; border-bottom: 1px solid var(--color-border); width: 100%; }
  .navtoggle { display: inline-flex; }
  .hero-grid, .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .hero-img { order: -1; aspect-ratio: 16/11; }
  .services { grid-template-columns: repeat(2, 1fr); }
  .grid-cols { grid-template-columns: repeat(2, 1fr); }
  .gallery { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 130px; }
  .gallery a, .gallery a.big, .gallery a.tall { grid-column: span 1; grid-row: span 1; }
  .gallery a.big { grid-column: span 2; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .services, .grid-cols { grid-template-columns: 1fr; }
  .hero-stats { gap: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
