/* ==========================================================================
   Scriptorium Bookworks - style.css
   Struktura: 1 tokeni, 2 reset/baza, 3 layout, 4 komponente, 5 sekcije, 6 utility
   U WP temi: ovaj fajl ide 1:1 kao glavni stylesheet (enqueue u functions.php)
   ========================================================================== */

/* 1. TOKENI ---------------------------------------------------------------- */
:root {
  --c-ground: #F4F3F0;
  --c-surface: #FFFFFF;
  --c-ink: #141414;
  --c-ink-2: #2B2A27;
  --c-ink-3: #3A3935;
  --c-muted: #4A4843;
  --c-rule: #C9C6BF;
  --c-placeholder: #E3E1DB;
  --c-accent: #D63A1E;        /* dugmad, aktivni nav, CTA traka */
  --c-accent-text: #B8301A;   /* crveni tekst na svetloj pozadini (kontrast 5:1+) */
  --c-accent-on-dark: #F0806B;
  --c-dark-text: #E9E7E2;
  --c-dark-muted: #9C9890;

  --f-sans: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --fs-display: clamp(2.75rem, 7vw, 6rem);
  --fs-h1: clamp(2.6rem, 6vw, 5.25rem);
  --fs-h2: clamp(1.9rem, 3.6vw, 3rem);
  --fs-h2-xl: clamp(2.1rem, 4vw, 3.5rem);
  --fs-lead: clamp(1.125rem, 1.6vw, 1.3rem);
  --fs-body: 1.0625rem;
  --fs-small: 0.9375rem;
  --fs-label: 0.75rem;

  --container: 1280px;
  --gutter: clamp(20px, 4vw, 48px);
  --section-y: clamp(64px, 9vw, 112px);
  --rule: 1.5px solid var(--c-ink);
  --rule-thin: 1px solid var(--c-rule);
  --rule-thick: 3px solid var(--c-ink);
}

/* 2. RESET / BAZA ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  font-family: var(--f-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--c-ink);
  background: var(--c-ground);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--c-accent-text); }
:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 3px; }
button { font: inherit; }

.skip-link {
  position: absolute; left: -9999px; top: 8px;
  background: var(--c-ink); color: #fff; padding: 10px 16px; z-index: 100;
}
.skip-link:focus { left: 8px; color: #fff; }

/* 3. LAYOUT ------------------------------------------------------------------ */
.container { max-width: var(--container); margin: 0 auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section-y); }
.section--surface { background: var(--c-surface); border-block: var(--rule); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: clamp(32px, 5vw, 64px); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--min, 240px)), 1fr)); gap: var(--gap, 32px); }

/* 4. KOMPONENTE -------------------------------------------------------------- */

/* Tipografija */
.label { font-family: var(--f-mono); font-size: var(--fs-label); letter-spacing: 0.2em; text-transform: uppercase; color: var(--c-accent-text); margin-bottom: 20px; }
.label--muted { color: var(--c-muted); letter-spacing: 0.16em; }
.h-display { font-size: var(--fs-display); line-height: 0.98; font-weight: 800; letter-spacing: -0.035em; max-width: 18ch; }
.h1 { font-size: var(--fs-h1); line-height: 0.98; font-weight: 800; letter-spacing: -0.035em; }
.h2 { font-size: var(--fs-h2); line-height: 1.08; font-weight: 700; letter-spacing: -0.025em; }
.h2--xl { font-size: var(--fs-h2-xl); font-weight: 800; letter-spacing: -0.03em; }
.lead { font-size: var(--fs-lead); line-height: 1.5; color: var(--c-ink-2); max-width: 36em; }
.prose { color: var(--c-ink-2); max-width: 38em; }
.mono { font-family: var(--f-mono); }

/* Dugmad */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 24px;
  font-weight: 600; font-size: var(--fs-small);
  border: 1.5px solid var(--c-ink); background: transparent; color: var(--c-ink);
  cursor: pointer; transition: background-color .15s, color .15s;
}
.btn:hover { background: var(--c-ink); color: #fff; }
.btn--primary { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }
.btn--primary:hover { background: var(--c-ink); border-color: var(--c-ink); color: #fff; }
.btn--dark { background: var(--c-ink); color: #fff; }
.btn--dark:hover { background: #fff; color: var(--c-ink); border-color: #fff; }
.btn--sm { min-height: 44px; padding: 0 18px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* Header */
.site-header { border-bottom: 1px solid var(--c-ink); background: var(--c-ground); position: sticky; top: 0; z-index: 50; }
.site-header__inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: baseline; gap: 8px; font-weight: 800; font-size: 1.125rem; letter-spacing: 0.02em; }
.brand__sub { font-family: var(--f-mono); font-weight: 500; font-size: 0.6875rem; letter-spacing: 0.18em; color: var(--c-accent-text); }
.brand:hover { color: var(--c-ink); }
.nav { display: flex; align-items: center; gap: 28px; }
.nav__list { display: flex; gap: 28px; list-style: none; margin: 0; padding: 0; font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.nav__link { display: inline-block; padding: 6px 0; border-bottom: 2px solid transparent; }
.nav__link[aria-current="page"] { border-bottom-color: var(--c-accent); }
.nav-toggle { display: none; min-height: 44px; min-width: 44px; background: none; border: 1.5px solid var(--c-ink); cursor: pointer; align-items: center; justify-content: center; }
.nav-toggle svg { width: 20px; height: 20px; }

@media (max-width: 960px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--c-ground); border-bottom: var(--rule); padding: 8px var(--gutter) 24px;
  }
  .nav.is-open { display: flex; }
  .nav__list { flex-direction: column; gap: 0; font-size: 1rem; }
  .nav__link { display: block; padding: 16px 0; border-bottom: var(--rule-thin); }
  .nav__link[aria-current="page"] { border-bottom: var(--rule-thin); color: var(--c-accent-text); }
  .nav .btn { margin-top: 16px; }
}

/* Spec tabela (hero) */
.spec { border-top: var(--rule); }
.spec__row { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: var(--rule-thin); font-size: var(--fs-small); }
.spec__k { font-weight: 600; }
.spec__v { font-family: var(--f-mono); font-size: 0.8125rem; color: var(--c-muted); text-align: right; }

/* Placeholder za sliku */
.media-ph {
  min-height: min(var(--h, 420px), 60vw); background: var(--c-placeholder); border: 1px dashed #8C8981;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center;
  font-family: var(--f-mono); font-size: var(--fs-label); color: var(--c-muted);
}
.media-ph svg { width: 28px; height: 28px; }

/* Service index red */
.index-list { border-top: var(--rule); list-style: none; margin: 0; padding: 0; }
.index-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 24px; align-items: start; padding: 32px 0; border-bottom: var(--rule-thin); }
.index-row:hover { color: inherit; }
.index-row:hover .index-row__title { color: var(--c-accent-text); }
.index-row__n { font-family: var(--f-mono); font-size: 0.875rem; color: var(--c-accent-text); padding-top: 6px; }
.index-row__body { display: flex; flex-direction: column; gap: 10px; }
.index-row__title { font-size: clamp(1.3rem, 2vw, 1.625rem); font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; transition: color .15s; }
.index-row__text { color: var(--c-ink-3); max-width: 47em; }
.index-row__tags { font-family: var(--f-mono); font-size: var(--fs-label); color: var(--c-muted); }
.index-row__arrow { font-size: 1.375rem; padding-top: 2px; transition: transform .15s; }
.index-row:hover .index-row__arrow { transform: translateX(4px); }
@media (max-width: 600px) {
  .index-row { grid-template-columns: 40px minmax(0, 1fr); }
  .index-row__arrow { display: none; }
}

/* Kartica sa debelom linijom (faze, klijenti, principi, notes) */
.tile { border-top: var(--rule-thick); padding-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.tile--thin { border-top: var(--rule); }
.tile__n { font-family: var(--f-mono); font-size: 0.8125rem; color: var(--c-accent-text); }
.tile__title { font-size: 1.375rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
.tile__text { font-size: var(--fs-small); color: var(--c-ink-3); }
.tile__meta { font-family: var(--f-mono); font-size: var(--fs-label); color: var(--c-muted); }
.tile__meta span { color: var(--c-accent-text); }
a.tile:hover { color: inherit; }
a.tile:hover .tile__title { color: var(--c-accent-text); }
.note .tile__title { font-size: 1.5rem; }

/* Logo grid */
.logo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); border-top: var(--rule-thin); border-left: var(--rule-thin); }
.logo-grid__cell { min-height: 110px; border-right: var(--rule-thin); border-bottom: var(--rule-thin); display: flex; align-items: center; justify-content: center; font-family: var(--f-mono); font-size: var(--fs-label); color: var(--c-muted); }

/* Section head (naslov levo, meta desno) */
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 40px; }

/* Lista sa brojem (needs, roles) */
.ruled-list { border-top: var(--rule); list-style: none; margin: 0; padding: 0; }
.ruled-list li { display: grid; grid-template-columns: var(--col, 48px) minmax(0, 1fr); gap: 16px 24px; padding: 22px 0; border-bottom: var(--rule-thin); }
.ruled-list__k { font-family: var(--f-mono); font-size: 0.8125rem; color: var(--c-accent-text); }
.ruled-list__k--strong { font-family: var(--f-sans); font-size: var(--fs-body); font-weight: 700; color: var(--c-ink); }
.ruled-list__v { font-weight: 600; font-size: 1.0625rem; }
.ruled-list__v--soft { font-weight: 400; font-size: var(--fs-small); color: var(--c-ink-3); }
@media (max-width: 600px) { .ruled-list--roles li { grid-template-columns: 1fr; } }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 0; padding: 0; }
.chip { border: 1px solid var(--c-ink); padding: 8px 14px; font-family: var(--f-mono); font-size: var(--fs-label); }
.chip-toggle { min-height: 44px; padding: 0 16px; border: 1.5px solid var(--c-ink); background: var(--c-surface); color: var(--c-ink); font-size: 0.875rem; font-weight: 600; cursor: pointer; }
.chip-toggle[aria-pressed="true"] { background: var(--c-ink); color: #fff; }

/* Forma */
.form-card { background: var(--c-surface); border: var(--rule); padding: clamp(24px, 4vw, 40px); }
.form { display: flex; flex-direction: column; gap: 22px; }
.field { display: flex; flex-direction: column; gap: 8px; font-size: 0.8125rem; font-weight: 600; }
.field input, .field textarea {
  font: inherit; font-weight: 400; font-size: 1rem; padding: 12px;
  border: 1px solid #8C8981; background: var(--c-ground); color: var(--c-ink); min-height: 48px; border-radius: 0;
}
.field textarea { resize: vertical; min-height: 140px; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--c-accent); outline-offset: 0; border-color: var(--c-ink); }
.field__hint { font-weight: 400; color: var(--c-muted); }
.field--error input { border-color: var(--c-accent-text); }
.field__error { font-weight: 500; color: var(--c-accent-text); display: none; }
.field--error .field__error { display: block; }
.dropzone { border: 1px dashed #8C8981; padding: 18px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; font-size: var(--fs-small); color: var(--c-ink-3); }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.form-success { display: none; flex-direction: column; gap: 16px; padding: 24px 0; }
.form-card.is-sent .form { display: none; }
.form-card.is-sent .form-success { display: flex; }

/* CTA traka */
.cta-band { background: var(--c-accent); color: #fff; }
.cta-band__inner { padding-block: clamp(56px, 7vw, 80px); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 32px; }
.cta-band .h2 { font-weight: 800; max-width: 24ch; }

/* Footer */
.site-footer { background: var(--c-ink); color: var(--c-dark-text); }
.site-footer a { color: var(--c-dark-text); }
.site-footer a:hover { color: var(--c-accent-on-dark); }
.site-footer__grid { padding-top: 80px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 40px; }
.site-footer .brand__sub { color: var(--c-accent-on-dark); }
.site-footer__about { font-size: 0.875rem; color: #BDBAB3; margin-top: 16px; max-width: 28ch; }
.site-footer__col { display: flex; flex-direction: column; gap: 10px; font-size: 0.875rem; list-style: none; margin: 0; padding: 0; }
.site-footer__h { font-family: var(--f-mono); font-size: 0.6875rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--c-dark-muted); margin-bottom: 6px; }
.site-footer address { font-style: normal; color: #BDBAB3; }
.site-footer__bottom { margin-top: 64px; padding: 24px 0 40px; border-top: 1px solid #3A3935; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; font-family: var(--f-mono); font-size: 0.6875rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--c-dark-muted); }
.site-footer__legal { display: flex; gap: 16px; list-style: none; margin: 0; padding: 0; }
.site-footer__legal a { color: var(--c-dark-muted); }

/* 5. SEKCIJE ----------------------------------------------------------------- */
.hero { padding-top: clamp(56px, 8vw, 96px); padding-bottom: 72px; }
.hero__grid { margin-top: 56px; align-items: start; }
.hero .lead { margin-bottom: 32px; }

.page-hero { padding-top: 56px; padding-bottom: clamp(56px, 7vw, 88px); }
.page-hero__grid { margin-top: 48px; align-items: end; }
.back-link { font-family: var(--f-mono); font-size: var(--fs-label); letter-spacing: 0.14em; text-transform: uppercase; color: var(--c-muted); }

.parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); border-top: var(--rule); }
.parts__item { padding: 28px 28px 32px 0; border-bottom: var(--rule-thin); display: flex; flex-direction: column; gap: 10px; }
.parts__item h3 { font-size: 1.3rem; font-weight: 700; }
.parts__item p { font-size: var(--fs-small); color: var(--c-ink-3); }

.related { border-top: var(--rule); }
.related__link { border-top: var(--rule-thick); padding-top: 16px; display: flex; justify-content: space-between; gap: 12px; font-size: 1.25rem; font-weight: 700; }
.related__link .tile__n { margin-right: 12px; font-weight: 500; }

/* 6. UTILITY ----------------------------------------------------------------- */
.mt-0 { margin-top: 0; } .mb-48 { margin-bottom: 48px; } .mb-56 { margin-bottom: 56px; } .mt-48 { margin-top: 48px; } .mt-64 { margin-top: 64px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 7. WORDPRESS (dodato u temi; iznad ove linije sve je 1:1 iz prototipa) ----- */
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.media-img { width: 100%; height: min(var(--h, 420px), 60vw); object-fit: cover; }
.logo-grid__img { max-width: 70%; max-height: 56px; width: auto; height: auto; object-fit: contain; filter: grayscale(1); }
.form__hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form__status { font-size: var(--fs-small); font-weight: 500; color: var(--c-accent-text); }
.form__status[hidden] { display: none; }
.form button[disabled] { opacity: 0.6; cursor: progress; }
/* Sadrzaj iz editora (single.php, page.php) - prototip resetuje margine na h/p */
.entry-content > * + * { margin-top: 1.1em; }
.entry-content > h2, .entry-content > h3 { margin-top: 1.8em; line-height: 1.15; letter-spacing: -0.02em; }
.entry-content > h2 { font-size: 1.75rem; }
.entry-content > h3 { font-size: 1.3rem; }
.entry-content a { color: var(--c-accent-text); text-decoration: underline; text-underline-offset: 2px; }
.entry-content ul, .entry-content ol { padding-left: 1.25em; }
.entry-content blockquote { margin-inline: 0; padding-left: 20px; border-left: var(--rule-thick); }
.entry-content figure { margin-inline: 0; }
.entry-content figcaption, .wp-element-caption { font-family: var(--f-mono); font-size: var(--fs-label); color: var(--c-muted); margin-top: 8px; }
.alignwide, .alignfull { max-width: none; }
