/* ==========================================================================
   Drvo Dizajn — main.css
   Design tokens, reset, typography, layout primitives.
   Boje i grid prema blueprintu (sekcije 42-45).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Brand colors */
  --c-ivory:        #F5F3EE;  /* architectural linen canvas      */
  --c-stone:        #E8E4DA;  /* quiet mineral section contrast  */
  --c-kimber:       #20251D;  /* deep timber / primary ink       */
  --c-oak:          #A8663F;  /* restrained kiln-dried oak       */
  --c-olive:        #5D684E;  /* natural secondary accent        */
  --c-olive-dark:   #3B4534;  /* deep foliage                    */
  --c-border:       #D6D0C4;  /* soft architectural line         */
  --c-white:        #FCFBF8;  /* elevated card surface            */

  /* Derived */
  --c-text:         #20251D;
  --c-text-muted:   #6C6D64;
  /* Gedämpfter Text auf getönter Fläche (Stone): hält AA, wo --c-text-muted
     mit 4.16:1 knapp darunter liegt. */
  --c-text-muted-strong: #5C5D55;
  --c-text-on-dark: #EFF0E9;
  --c-text-dark-muted: #C9CCC0;
  --c-kimber-soft:  #3B4534;
  --c-oak-dark:     #7C482D;

  /* Typography */
  --font-text: "Wix Madefor Text", -apple-system, BlinkMacSystemFont, "Segoe UI",
               Helvetica, Arial, sans-serif;
  --font-display: "Wix Madefor Display", "Wix Madefor Text", -apple-system,
                  BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  /* Backward-compatible alias for controls and components. */
  --font-sans: var(--font-text);

  --fs-hero:    clamp(2.375rem, 6.2vw, 3.75rem);   /* 38 -> 60 */
  --fs-h2:      clamp(1.75rem, 3.6vw, 2.5rem);     /* 28 -> 40 */
  --fs-h3:      clamp(1.1875rem, 2vw, 1.5rem);     /* 19 -> 24 */
  --fs-h4:      1.0625rem;
  --fs-body:    1.0625rem;                          /* 17 */
  --fs-lead:    clamp(1.0625rem, 1.5vw, 1.25rem);
  --fs-small:   0.9375rem;
  --fs-label:   0.75rem;

  --lh-tight:   1.08;
  --lh-heading: 1.18;
  --lh-body:    1.65;

  /* Spacing */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;
  --sp-9: 5rem;

  /* Section rhythm: 80-120px desktop */
  --section-y: clamp(3.5rem, 7vw, 7.5rem);

  /* Layout */
  --container:  1280px;
  --container-narrow: 880px;
  --gutter:     clamp(1.25rem, 4vw, 2.5rem);

  /* Radius / borders / shadow */
  --radius-sm:  10px;
  --radius:     16px;
  --radius-lg:  20px;
  --border:     1px solid var(--c-border);
  --shadow-sm:  0 1px 2px rgba(32, 37, 29, 0.04);
  --shadow:     0 5px 18px rgba(32, 37, 29, 0.06);
  --shadow-lg:  0 18px 42px rgba(32, 37, 29, 0.12);

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur:  0.22s;

  /* Header */
  --header-h: 76px;
}

/* --------------------------------------------------------------------------
   2. Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  overflow-x: clip;
}

body {
  margin: 0;
  padding-top: 0;
  font-family: var(--font-text);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--c-text);
  background: var(--c-ivory);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3 { font-family: var(--font-display); }
h1, h2, h3, h4, h5, h6 { margin: 0 0 var(--sp-4); font-weight: 700; line-height: var(--lh-heading); letter-spacing: -0.018em; }
h1 { font-size: var(--fs-hero); line-height: var(--lh-tight); letter-spacing: -0.028em; font-weight: 800; }
h2 { font-size: var(--fs-h2); letter-spacing: -0.024em; }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }

p  { margin: 0 0 var(--sp-4); }
p:last-child { margin-bottom: 0; }

a { color: inherit; text-decoration-color: var(--c-oak); text-underline-offset: 3px; }
a:hover { color: var(--c-oak-dark); }

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

ul, ol { margin: 0 0 var(--sp-4); padding-left: 1.15rem; }
li { margin-bottom: 0.35rem; }
li:last-child { margin-bottom: 0; }

strong, b { font-weight: 700; }

button { font: inherit; color: inherit; }

table { border-collapse: collapse; width: 100%; }

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

::selection { background: var(--c-oak); color: var(--c-white); }

/* --------------------------------------------------------------------------
   3. Layout primitives
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: var(--container-narrow); }

.section { padding-block: var(--section-y); }
.section--tight { padding-block: clamp(2.5rem, 5vw, 4.5rem); }

.section--ivory  { background: var(--c-ivory); }
.section--white  { background: var(--c-white); }
.section--stone  { background: var(--c-stone); }
.section--dark   { background: var(--c-kimber); color: var(--c-text-on-dark); }
.section--dark h1, .section--dark h2, .section--dark h3, .section--dark h4 { color: var(--c-white); }
.section--dark a { color: var(--c-white); }
.section--dark .lead { color: var(--c-text-dark-muted); }

.grid { display: grid; gap: var(--sp-5); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stack > * + * { margin-top: var(--sp-4); }

/* --------------------------------------------------------------------------
   4. Typographic helpers
   -------------------------------------------------------------------------- */
.eyebrow {
  display: inline-block;
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-oak-dark);
  margin-bottom: var(--sp-4);
}
.section--dark .eyebrow { color: var(--c-oak); }

.eyebrow--rule::before {
  content: "";
  display: inline-block;
  width: 28px;
  height: 1px;
  background: var(--c-oak);
  vertical-align: middle;
  margin-right: 0.7em;
}

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

.section-head { max-width: 46rem; margin-bottom: clamp(2rem, 4vw, 3.25rem); }
.section-head--center { margin-inline: auto; text-align: center; }

.text-muted { color: var(--c-text-muted); }
.text-oak   { color: var(--c-oak-dark); }
.nowrap     { white-space: nowrap; }

.fineprint {
  font-size: var(--fs-small);
  color: var(--c-text-muted);
  line-height: 1.55;
}
.section--dark .fineprint { color: var(--c-text-dark-muted); }

/* Utility */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; top: -100px; left: var(--sp-4); z-index: 999;
  background: var(--c-kimber); color: var(--c-white);
  padding: var(--sp-3) var(--sp-5); border-radius: var(--radius-sm);
}
.skip-link:focus { top: var(--sp-3); }

/* --------------------------------------------------------------------------
   5. Motion (reveal on scroll — progressive enhancement)
   -------------------------------------------------------------------------- */
/* Native same-origin MPA transition. The glass navigation is captured
   separately, so it stays visually anchored while page content changes. */
@view-transition {
  navigation: auto;
}

.site-header { view-transition-name: dd-navigation; }
#main { view-transition-name: dd-page; }

::view-transition-group(root),
::view-transition-group(dd-navigation),
::view-transition-group(dd-page) {
  animation-timing-function: cubic-bezier(.16, 1, .3, 1);
}
::view-transition-old(root) { animation: dd-root-out .18s ease-out both; }
::view-transition-new(root) { animation: dd-root-in .42s cubic-bezier(.16, 1, .3, 1) both; }
::view-transition-old(dd-page) { animation: dd-page-out .14s cubic-bezier(.4, 0, 1, 1) both; }
::view-transition-new(dd-page) { animation: dd-page-in .5s .11s cubic-bezier(.16, 1, .3, 1) both; }
::view-transition-old(dd-navigation) { animation: dd-nav-out .12s ease-out both; }
::view-transition-new(dd-navigation) { animation: dd-nav-in .34s .1s cubic-bezier(.16, 1, .3, 1) both; }

@keyframes dd-root-out { to { opacity: .86; } }
@keyframes dd-root-in { from { opacity: .86; } }
@keyframes dd-page-out {
  to { opacity: 0; transform: translate3d(0, -.3rem, 0) scale(.999); }
}
@keyframes dd-page-in {
  from { opacity: 0; transform: translate3d(0, .72rem, 0) scale(.998); }
  to { opacity: 1; transform: none; }
}
@keyframes dd-nav-out {
  to { opacity: 0; transform: translate3d(0, -.2rem, 0) scale(.997); }
}
@keyframes dd-nav-in {
  from { opacity: .72; transform: translate3d(0, -.3rem, 0) scale(.997); }
  to { opacity: 1; transform: none; }
}
@keyframes dd-document-enter {
  from { opacity: 0; transform: translate3d(0, .7rem, 0) scale(.998); }
  to { opacity: 1; transform: none; }
}
@keyframes dd-navigation-enter {
  from { opacity: 0; transform: translate3d(0, -.55rem, 0); }
  to { opacity: 1; transform: none; }
}

#main {
  animation: dd-document-enter .58s cubic-bezier(.16, 1, .3, 1) both;
  transform-origin: 50% 0;
}
/* Fill-mode je namjerno `backwards`, ne `both`: uz `both` element trajno ostaje
   u fill fazi, pa `transform` ostaje izracunat kao identity matrica umjesto
   `none`. Svaka vrijednost osim `none` pravi containing block, sto je fiksirani
   mobilni meni (.nav) zarobljavalo unutar headera. Ulazna animacija ostaje ista. */
.site-header { animation: dd-navigation-enter .46s .04s cubic-bezier(.16, 1, .3, 1) backwards; }
html:active-view-transition #main,
html:active-view-transition .site-header,
html.has-native-page-transition #main,
html.has-native-page-transition .site-header { animation: none; }

/* Scroll reveals use a soft optical focus instead of an abrupt pop. */
.js .reveal {
  opacity: 0;
  transform: translate3d(0, 1.1rem, 0) scale(.994);
  transition:
    opacity .7s cubic-bezier(.16, 1, .3, 1),
    transform .82s cubic-bezier(.16, 1, .3, 1);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

.js .reveal-stagger > * {
  opacity: 0;
  transform: translate3d(0, 1.2rem, 0) scale(.992);
  transition:
    opacity .62s cubic-bezier(.16, 1, .3, 1),
    transform .76s cubic-bezier(.16, 1, .3, 1);
  transition-delay: calc(var(--stagger-index, 0) * 65ms);
}
.js .reveal-stagger.is-visible > * { opacity: 1; transform: none; }

@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;
  }
  .js .reveal { opacity: 1; transform: none; }
  .js .reveal-stagger > * { opacity: 1; transform: none; }
  #main,
  .site-header { animation: none !important; }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
  }
}
