/* Högsåsens Naturreservat — one stylesheet, no JS.
   Tokens are taken from the design: cream paper, forest green, a gold hairline. */

/* ---------- fonts ---------- */
@font-face {
  font-family: 'Fraunces';
  src: url('/assets/fonts/fraunces-var.woff2') format('woff2-variations');
  font-weight: 600 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter-var.woff2') format('woff2-variations');
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

/* ---------- tokens ---------- */
:root {
  --cream: #faf6ee;
  --cream-2: #f2ead9; /* raised surfaces only (nav pill, tiles) — never a section band */
  --ink: #211d17;
  --ink-soft: #4a453d;
  --gold: #d7a13d;
  --gold-text: #8a6118; /* gold is for lines and fills; this passes 4.5:1 on cream */
  --green: #39442f;
  --green-dark: #2b3324;
  --line: rgba(33, 29, 23, 0.12);
  --line-light: rgba(250, 246, 238, 0.16);
  --shadow-photo: 0 8px 24px rgba(20, 17, 12, 0.25);

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

  /* 8px scale */
  --s1: 8px;
  --s2: 16px;
  --s3: 24px;
  --s4: 32px;
  --s5: 40px;
  --s6: 48px;
  --s8: 64px;
  --s9: 72px;
  --s12: 96px;

  --wrap: 1180px;
  --gutter: 16px;
  --section-y: 80px;
  --nav-h: 52px;

  --r-pill: 999px;
  --r-card: 16px;
  --r-photo: 22px;
  --r-tile: 24px;
}

@media (min-width: 560px) {
  :root { --gutter: 20px; --nav-h: 56px; }
}
@media (min-width: 860px) {
  :root { --gutter: 32px; --section-y: 120px; }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* anchored sections clear the floating nav */
  scroll-padding-top: calc(var(--nav-h) + 48px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 900;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}

p { margin: 0; color: var(--ink-soft); }
a { color: inherit; }
img { display: block; max-width: 100%; }
ul, ol { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
  border-radius: 4px;
}
.hero :focus-visible,
.footer :focus-visible,
.section--green :focus-visible { outline-color: var(--gold); }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: 0;
  z-index: 50;
  transform: translateY(-120%);
  padding: 12px 20px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  background: var(--cream);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 var(--r-card) var(--r-card);
  box-shadow: var(--shadow-photo);
  transition: transform 0.2s ease;
}
.skip-link:focus { transform: translateY(0); }

/* ---------- navigation ---------- */
/* One floating pill at every width: leaf, links, language. It shrinks rather
   than restyles, so there is a single thing to redesign later. */
.nav {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--s2);
  width: max-content;
  max-width: calc(100% - 2 * var(--gutter));
  min-height: var(--nav-h);
  padding: var(--s1) var(--s2);
  border-radius: var(--r-pill);
  background: var(--cream-2);
  box-shadow: 0 8px 28px rgba(20, 17, 12, 0.14);
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  min-height: 40px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.125rem;
  text-decoration: none;
}
.nav-brand svg { flex: none; }

/* Below 560px only the leaf shows, so the pill stays on one line at 320px.
   The name is clipped rather than removed, so it still names the link. */
.nav-brand span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--s2);
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
}
.nav-links a:hover { text-decoration: underline; text-underline-offset: 6px; }
.nav-links a[aria-current='page'] {
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 3px;
  text-underline-offset: 6px;
}

.nav-lang {
  display: flex;
  align-items: center;
  padding-left: var(--s2);
  border-left: 1px solid var(--line);
  font-size: 0.8125rem;
}
.nav-lang a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 40px;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink-soft);
}
.nav-lang a[aria-current='true'] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 3px;
  text-underline-offset: 6px;
}

@media (max-width: 400px) {
  .nav { gap: var(--s1); padding-inline: 12px; }
  .nav-links { gap: 12px; }
  .nav-links a { font-size: 0.875rem; }
  .nav-lang { padding-left: var(--s1); }
  .nav-lang a { min-width: 28px; }
}

@media (min-width: 560px) {
  .nav {
    top: 20px;
    gap: var(--s4);
    padding: var(--s1) var(--s3);
  }
  .nav-brand span {
    position: static;
    width: auto;
    height: auto;
    clip-path: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ---------- hero ---------- */
/* Type on a dark green field, with the photograph given its own band below.
   Nothing sits on top of a photo, so contrast is fixed rather than managed. */
.hero {
  padding: calc(var(--nav-h) + var(--s9)) 0 var(--s9);
  background: var(--green-dark);
  color: var(--cream);
  text-align: center;
}

.hero h1 {
  font-size: clamp(2.75rem, 10vw, 7rem);
  line-height: 0.95;
  margin-bottom: var(--s3);
  color: var(--cream);
  text-wrap: balance;
  overflow-wrap: break-word;
}

.hero p {
  max-width: 40ch;
  margin-inline: auto;
  font-size: 1rem;
  line-height: 1.4;
  color: rgba(250, 246, 238, 0.9);
  text-wrap: balance;
}

@media (min-width: 560px) { .hero p { font-size: 1.25rem; } }
@media (min-width: 860px) {
  .hero { padding: calc(var(--nav-h) + var(--s12)) 0 var(--s12); }
  .hero p { font-size: 1.5rem; }
}

/* a gold rule closes the block and hands you on to the photograph */
.hero-inner::after {
  content: '';
  display: block;
  width: 72px;
  height: 4px;
  margin: var(--s5) auto 0;
  background: var(--gold);
  border-radius: 2px;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  min-height: 48px;
  margin-top: var(--s4);
  padding-inline: var(--s3);
  border-radius: var(--r-pill);
  background: var(--cream);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-photo);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), background 0.25s ease;
}
.button:hover { background: #fff; transform: translateY(-2px); }
.button--green { background: var(--green); color: var(--cream); }
.button--green:hover { background: #46543a; }

/* One orchestrated moment: the hero settles in on load. Nothing else moves. */
@keyframes rise {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: none; }
}
.hero h1 { animation: rise 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.1s backwards; }
.hero p { animation: rise 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.24s backwards; }
.hero .button { animation: rise 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.38s backwards; }

/* ---------- page header (Kontakt, Tillgänglighet, 404) ---------- */
.page-head {
  padding: calc(var(--nav-h) + var(--s8)) 0 var(--s6);
  border-bottom: 1px solid var(--line);
}
.page-head h1 {
  font-size: clamp(2rem, 6vw, 3.25rem);
  line-height: 1.05;
  text-wrap: balance;
}
.page-head p {
  max-width: 60ch;
  margin-top: var(--s2);
  font-size: 1.125rem;
}

/* ---------- sections ---------- */
.section { padding-block: var(--section-y); }
/* Where two cream sections meet, a hairline marks the seam. Sand bands used to
   do this job; one line is quieter and keeps the palette to green + gold. */
.section--rule { border-top: 1px solid var(--line); }
/* A single green section mid-page, to break the run of cream. Which section
   carries it is set by `tone: 'green'` in tools/content.mjs. */
.section--green { background: var(--green); color: var(--cream); }
.section--green h2 { color: var(--cream); }
.section--green p { color: rgba(250, 246, 238, 0.85); }

.section h2 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.05;
  text-wrap: balance;
}

.section-head { margin-bottom: var(--s6); }
.section-head p { max-width: 60ch; margin-top: var(--s2); }

/* image + text */
.split { display: grid; gap: var(--s5); }
.split img {
  width: 100%;
  /* height:auto, or the width/height attributes win over aspect-ratio */
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--r-photo);
}
.split h2 { margin-bottom: var(--s2); }
.split p + p { margin-top: var(--s2); }
.split-text p { max-width: 62ch; }

@media (min-width: 860px) {
  .section--split { padding-block: var(--s12); }
  .split { grid-template-columns: 1fr 1fr; gap: var(--s9); align-items: center; }
  .split--reverse .split-media { order: 2; }
}

/* ---------- activities ---------- */
.activities { display: grid; gap: var(--s4); }
.activity { padding-top: var(--s3); border-top: 2px solid var(--gold); }
.activity h3 {
  margin-bottom: var(--s1);
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.2;
}
.activity p { max-width: 55ch; }

@media (min-width: 860px) {
  .activities { grid-template-columns: 1fr 1fr; gap: var(--s5) var(--s8); }
  .activity h3 { font-size: 1.5rem; }
}

/* ---------- trails (Vandring) ---------- */
.trails { display: grid; gap: var(--s2); }

.trail {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s1);
  padding: var(--s3);
  background: var(--cream);
  border-radius: var(--r-card);
}

.trail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s1) var(--s2);
}
.trail-head h3 { font-size: 1.375rem; font-weight: 600; }
.trail-length { font-weight: 600; color: var(--gold-text); }
.trail-text { max-width: 54ch; }

.trail-download {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  min-height: 44px;
  margin-top: auto;
  padding-top: var(--s1);
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--green);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.trail-meta { font-weight: 400; color: var(--ink-soft); }

@media (min-width: 860px) {
  .trails { grid-template-columns: 1fr 1fr; gap: var(--s3); }
}

/* ---------- visit tiles (Kontakt) ---------- */
.tiles { display: grid; gap: var(--s2); }
.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s1);
  padding: var(--s3);
  border-radius: var(--r-tile);
  background: var(--cream-2);
  color: var(--ink);
}
.tile-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: var(--s1);
  border-radius: 50%;
  background: var(--green);
  color: var(--cream);
}
.tile-icon svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tile h2, .tile h3 { font-size: 1.5rem; line-height: 1.2; font-weight: 600; }
.tile p { margin-bottom: var(--s1); }
.tile .button { margin-top: auto; }
.tile p:last-child { margin-bottom: 0; }
.tile-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
  color: var(--ink);
  text-decoration-color: var(--gold);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

@media (min-width: 700px) { .tiles { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } }

.notfound-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
  margin-top: var(--s4);
}
.notfound-actions .button { margin-top: 0; }

/* ---------- prose (accessibility statement) ---------- */
.prose { max-width: 68ch; }
.prose h2 { margin-top: var(--s6); margin-bottom: var(--s2); font-size: 1.5rem; }
.prose h2:first-child { margin-top: 0; }
.prose p + p, .prose ul { margin-top: var(--s2); }
.prose li { position: relative; padding-left: var(--s3); color: var(--ink-soft); }
.prose li + li { margin-top: var(--s1); }
.prose li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 10px;
  height: 2px;
  background: var(--gold);
}
.prose a { color: var(--green); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.prose .button { margin-top: var(--s5); color: var(--cream); text-decoration: none; }

/* ---------- footer ---------- */
.footer {
  padding: var(--s8) 0 var(--s5);
  background: var(--green-dark);
  color: var(--cream);
  border-top: 1px solid var(--line-light);
}
.footer-grid { display: grid; gap: var(--s5); padding-bottom: var(--s6); border-bottom: 1px solid var(--line-light); }
.footer-name {
  display: block;
  margin-bottom: var(--s1);
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(2rem, 5vw, 2.5rem);
  line-height: 1.05;
}
.footer-brand p { color: rgba(250, 246, 238, 0.75); max-width: 40ch; }
.footer h2 {
  margin-bottom: var(--s1);
  font-family: var(--text);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(250, 246, 238, 0.65);
}
.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  min-height: 44px;
  font-weight: 600;
  text-decoration: none;
}
.footer-links a:hover {
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1) var(--s3);
  padding-top: var(--s4);
  font-size: 0.875rem;
  color: rgba(250, 246, 238, 0.65);
}
.footer :focus-visible { outline-color: var(--gold); }

@media (min-width: 700px) {
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; gap: var(--s4) var(--s8); }
}

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Without the sand band the page header and the first section ran together as
   one large gap; the hairline already marks the break, so close the distance. */
.page-head + .section { padding-top: var(--s6); }
