/* Tehnoetika platforma — editorijalna tema (Sapere Aude: Lora/Spectral + krem/zlato), akcent po publikaciji (--accent). */
:root {
  --accent: #8c1b11;          /* fallback burgundy; publikacija ga override-a preko Head inline stila */
  --gold: #b8935a;            /* topli tan/zlato — dekorativni akcent (rubrike, hairline detalji) */
  --ink: #1a1a1a;             /* skoro crna (Substack ink) */
  --muted: #4f4f4f;           /* deck / sekundarni tekst */
  --faint: #8a8078;           /* meta labele, datumi */
  --line: #e4ded4;            /* hairline borderi */
  --rule: #1a1a1a;            /* jaki crni print-rule */
  --bg: #fafafa;              /* Substack off-white */
  --footer-bg: #f3f0e9;       /* topli off-white footer */
  --serif: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Times New Roman', serif;
  --serif-display: 'Spectral', 'Lora', Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; height: auto; }
main { max-width: 1180px; margin: 0 auto; padding: 0 1.5rem 4rem; }

/* Uska čitljiva mjera za članke / arhivu / statične stranice (~70ch). */
.reading-col { max-width: 720px; margin: 0 auto; }

/* Sekcijska labela — sans, uppercase, "print rubrika". */
.section-label {
  font-family: var(--sans); font-size: .8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .18em; color: var(--faint); margin: 0 0 1rem;
  padding-bottom: .6rem; border-bottom: 2px solid var(--rule);
}

/* ---------- Tenant masthead ---------- */
.site-header { text-align: center; padding: 2.4rem 1rem 1.1rem; border-bottom: 2px solid var(--rule); margin-bottom: 2.4rem; }
.site-identity { display: inline-flex; align-items: center; gap: .7rem; color: var(--ink); }
.site-identity:hover { text-decoration: none; }
.site-logo { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.site-name {
  font-family: var(--serif-display); font-weight: 500; line-height: 1.05;
  font-size: clamp(1.8rem, 4vw, 2.7rem); letter-spacing: .01em;
}
.site-tagline { font-family: var(--serif); font-style: italic; color: var(--muted); margin: .5rem auto 1.1rem; max-width: 620px; font-size: 1.05rem; }
.site-nav {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: .4rem .9rem; padding-top: 1rem; border-top: 1px solid var(--line);
  font-family: var(--sans); font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .14em;
}
.site-nav a { color: var(--ink); }
.site-nav a:hover { color: var(--accent); text-decoration: none; }
.site-nav a + a { border-left: 1px solid var(--line); padding-left: .9rem; }

/* ---------- Subscribe ---------- */
.subscribe { background: var(--footer-bg); border: 1px solid var(--line); border-radius: 4px; padding: 1.4rem 1.5rem; margin: 0 0 2rem; }
.subscribe-lead { margin: 0 0 .7rem; font-family: var(--serif); font-size: 1.2rem; font-weight: 500; }
.subscribe-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.subscribe input[type="email"] { flex: 1 1 220px; padding: .6rem .85rem; border: 1px solid var(--line); border-radius: 3px; font-size: 1rem; background: #fff; }
.subscribe button, .btn, button[type="submit"] {
  background: var(--accent); color: #fff; border: 0; border-radius: 3px;
  padding: .6rem 1.3rem; font-size: .8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; cursor: pointer;
}
.btn { display: inline-block; }
.btn:hover { text-decoration: none; opacity: .92; }

/* ---------- Home: editorijalni grid (featured 2fr + Najnovije 1fr) ---------- */
.home { display: grid; grid-template-columns: 2fr 1fr; gap: 3rem; align-items: start; }
.home-cta { margin-top: 3rem; padding-top: 2.4rem; border-top: 2px solid var(--rule); }
.home-cta .subscribe { margin: 0; }

/* Tematske sekcije ispod featured grida (First Things rubrike). */
.home-section { margin-top: 2.8rem; padding-top: 1.6rem; border-top: 2px solid var(--rule); }
.home-section .section-label a { color: var(--ink); }
.home-section .section-label a:hover { color: var(--accent); text-decoration: none; }
.section-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.4rem 2.6rem; }
.section-grid .post-card { border-top: 0; padding: 0; }
@media (max-width: 700px) { .section-grid { grid-template-columns: 1fr; } }

.hero { border: 0; }
.hero-cover { border-radius: 3px; margin-bottom: 1rem; width: 100%; }
.hero h2 { font-family: var(--serif-display); font-weight: 500; letter-spacing: -.01em; font-size: clamp(1.9rem, 3.4vw, 3rem); margin: 0 0 .5rem; line-height: 1.08; }
.hero h2 a { color: var(--ink); }
.hero h2 a:hover { color: var(--accent); text-decoration: none; }
.hero-subtitle { font-family: var(--serif); color: var(--muted); font-size: 1.2rem; line-height: 1.45; margin: 0 0 .6rem; }

/* Meta (datumi/kicker) — sans, uppercase. */
.hero time, .post-card time, .latest-item time {
  display: inline-block; font-family: var(--sans); font-size: .72rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .1em; color: var(--faint);
}

/* Najnovije — tekstualna lista bez thumbnaila. */
.home-latest { position: sticky; top: 1.5rem; }
.latest { list-style: none; margin: 0; padding: 0; }
.latest-item { padding: .9rem 0; border-top: 1px solid var(--line); }
.latest-item:first-child { border-top: 0; padding-top: 0; }
.latest-item a { font-family: var(--serif); font-weight: 500; font-size: 1.15rem; line-height: 1.2; color: var(--ink); display: block; margin-bottom: .3rem; }
.latest-item a:hover { color: var(--accent); text-decoration: none; }

/* ---------- Post lista / kartice (arhiva + sekundarni) ---------- */
.post-list { display: flex; flex-direction: column; }
.post-card { display: flex; gap: 1.4rem; justify-content: space-between; align-items: start; padding: 1.5rem 0; border-top: 1px solid var(--line); }
.post-card:first-child { border-top: 0; }
.post-card-text { flex: 1; }
.post-card h3 { font-family: var(--serif-display); font-weight: 500; font-size: 1.5rem; margin: 0 0 .35rem; line-height: 1.15; }
.post-card h3 a { color: var(--ink); }
.post-card h3 a:hover { color: var(--accent); text-decoration: none; }
.post-card-subtitle { font-family: var(--serif); color: var(--muted); margin: 0 0 .45rem; font-size: 1.02rem; line-height: 1.4; }
.post-card-thumb { width: 150px; height: 100px; object-fit: cover; border-radius: 3px; flex-shrink: 0; }

.page-title { font-family: var(--serif-display); font-weight: 500; font-size: clamp(1.9rem, 3vw, 2.4rem); margin: 0 0 1.4rem; letter-spacing: -.01em; }
.pagination { display: flex; justify-content: space-between; padding: 1.8rem 0; font-family: var(--sans); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.more { margin-top: 1rem; font-family: var(--sans); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.empty { color: var(--muted); text-align: center; padding: 2rem 0; }

/* ---------- Article / reading ---------- */
.post h1 { font-family: var(--serif-display); font-weight: 500; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.08; letter-spacing: -.015em; margin: 0 0 .5rem; }
.post-subtitle { font-family: var(--serif); color: var(--muted); font-size: 1.35rem; line-height: 1.35; margin: 0 0 1.2rem; }
.byline {
  display: flex; align-items: center; gap: .6rem; margin-bottom: 1.6rem;
  padding-bottom: 1.1rem; border-bottom: 1px solid var(--line);
  font-family: var(--sans); font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em;
}
.byline img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.byline > span:not(.dot) { color: var(--accent); }
.byline .dot { color: var(--line); }
.byline time { color: var(--faint); }
.post-cover { border-radius: 3px; margin-bottom: 1.6rem; width: 100%; }

.post-body { font-family: var(--serif); font-size: 1.25rem; line-height: 1.7; color: var(--ink); }
.post-body > p { margin: 0 0 1.1em; }
.post-body > p:first-of-type::first-letter {
  float: left; font-family: var(--serif); font-weight: 500; font-size: 3.4em;
  line-height: .74; padding: .05em .08em 0 0; color: var(--ink);
}
.post-body h2, .post-body h3, .post-body h4 { font-family: var(--serif-display); font-weight: 500; line-height: 1.2; margin: 1.6em 0 .5em; }
.post-body h2 { font-size: 1.6rem; }
.post-body h3 { font-size: 1.35rem; }
.post-body a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.post-body hr { border: 0; border-top: 1px solid var(--rule); margin: 2.2rem auto; width: 40%; }
.post-body blockquote { border-left: 3px solid var(--accent); margin: 1.4em 0; padding: .2em 0 .2em 1.3em; color: var(--muted); font-style: italic; }
.post-body img { border-radius: 3px; margin: 1em 0; }
.post-body code { background: #f2efe8; padding: .1em .35em; border-radius: 3px; font-size: .85em; font-family: ui-monospace, monospace; }
.post-body pre { background: #f2efe8; padding: 1em; border-radius: 6px; overflow-x: auto; }
.post-body pre code { background: none; padding: 0; }

.embed { position: relative; aspect-ratio: 16 / 9; margin: 1.4em 0; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 3px; }
.embed-video video { width: 100%; border-radius: 3px; margin: 1.4em 0; }

/* ---------- Footer ---------- */
.site-footer { background: var(--footer-bg); border-top: 2px solid var(--rule); margin-top: 4rem; padding: 2.5rem 1.5rem; }
.site-footer .subscribe { max-width: 620px; margin: 0 auto 1.4rem; background: #fff; }
.footer-meta { text-align: center; color: var(--faint); font-family: var(--sans); font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; }
.footer-meta a { color: var(--muted); }

.flash { padding: .8rem 1rem; border-radius: 4px; margin: 1rem 0; }
.flash-ok { background: #e8f5ee; border: 1px solid #b7dfc9; }
.flash-err { background: #fdeaea; border: 1px solid #f2bcbc; }

/* Tenant responsive */
@media (max-width: 820px) {
  .home { grid-template-columns: 1fr; gap: 2.4rem; }
  .home-latest { position: static; }
}
@media (max-width: 560px) {
  .post-card-thumb { width: 96px; height: 68px; }
  .post-body > p:first-of-type::first-letter { font-size: 2.8em; }
}

/* ---------- Platforma / dashboard ---------- */
.platform main.platform-main { max-width: 960px; padding-top: 1.5rem; }
.platform-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 3.5rem; padding: .6rem 1.5rem; border-bottom: 1px solid var(--line); }
.platform-header .brand { display: inline-flex; align-items: center; line-height: 1; font-weight: 700; font-size: 1.15rem; color: var(--ink); }
.platform-header .brand span { color: var(--accent); font-weight: 400; }
.platform-header nav { display: flex; align-items: center; gap: 1rem; }
.platform-header nav a { display: inline-flex; align-items: center; line-height: 1; }
.platform-header .inline-form { display: inline-flex; align-items: center; margin: 0; }
.platform-footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 2rem; }
.inline-form { display: inline; }
.linklike { background: none; border: 0; color: var(--accent); cursor: pointer; font-size: 1rem; padding: 0; }

.landing-hero { text-align: center; padding: 3rem 1rem 2rem; }
.landing-hero h1 { font-family: var(--serif); font-size: 2.2rem; }
.pub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; padding: 1rem 0; }
.pub-card { border: 1px solid var(--line); border-radius: 10px; padding: 1.1rem; color: var(--ink); background: #fff; }
.pub-card:hover { border-color: var(--accent); text-decoration: none; }
.pub-card h3 { margin: 0 0 .3rem; }
.pub-card p { margin: 0; color: var(--muted); font-size: .92rem; }
.pub-card.new { border-style: dashed; text-align: center; color: var(--accent); }

.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 1.5rem; margin: 1rem 0; }
.card.narrow { max-width: 420px; margin: 2rem auto; }
label { display: block; margin: .8rem 0; font-weight: 600; font-size: .95rem; }
label input, label select, label textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .5rem .7rem;
  border: 1px solid var(--line); border-radius: 6px; font-size: 1rem; font-family: inherit; font-weight: 400;
}
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
label.check input { width: auto; margin: 0; }
.muted { color: var(--muted); font-weight: 400; font-size: .9rem; }

.dash-nav { display: flex; align-items: center; gap: 1.2rem; padding: .8rem 0; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.dash-nav a.active { font-weight: 700; }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* Rubrike (dashboard) */
.cat-add { display: flex; gap: .6rem; margin: 1rem 0 1.4rem; flex-wrap: wrap; }
.cat-add input { flex: 1 1 260px; padding: .6rem .85rem; border: 1px solid var(--line); border-radius: 6px; font-size: 1rem; background: #fff; }
.cat-list { list-style: none; padding: 0; margin: 0; }
.cat-list li { display: flex; align-items: center; gap: 1rem; padding: .8rem 1rem; background: #fff; border: 1px solid var(--line); border-radius: 8px; margin-bottom: .5rem; }
.cat-list li > a { font-weight: 600; }
.cat-list li code { font-size: .85rem; }
.cat-list li .inline-form { margin-left: auto; }

.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.table th, .table td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); }
.badge { font-size: .78rem; padding: .15rem .5rem; border-radius: 99px; background: #eee; }
.badge-published, .badge-confirmed { background: #e8f5ee; color: #14683f; }
.badge-draft, .badge-pending { background: #fdf3e0; color: #8a5a00; }
.badge-unsubscribed { background: #fdeaea; color: #a02020; }

/* Editor */
.editor { display: grid; grid-template-columns: 1fr 260px; gap: 1.5rem; align-items: start; }
@media (max-width: 800px) { .editor { grid-template-columns: 1fr; } .post-card-thumb { width: 90px; height: 64px; } }
.editor-title { font-family: var(--serif); font-size: 1.7rem; font-weight: 700; border: 0; border-bottom: 1px solid var(--line); width: 100%; padding: .4rem 0; background: transparent; }
.editor-subtitle { font-size: 1.05rem; color: var(--muted); border: 0; border-bottom: 1px solid var(--line); width: 100%; padding: .4rem 0; margin-top: .3rem; background: transparent; }
.editor-toolbar { display: flex; gap: .4rem; align-items: center; margin: .8rem 0; flex-wrap: wrap; }
.editor-toolbar button { background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: .35rem .7rem; cursor: pointer; }
.editor-toolbar button:hover { background: var(--paper, #f7f5f0); }
.editor-toolbar button.fmt { min-width: 2rem; padding: .35rem .55rem; font-size: .95rem; line-height: 1; text-align: center; }
.editor-toolbar .tb-sep { width: 1px; align-self: stretch; background: var(--line); margin: .1rem .3rem; }
#body-md { width: 100%; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: .95rem; line-height: 1.6; padding: .8rem; border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
#body-md.drag-over { border-color: var(--accent, #1a7f6b); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #1a7f6b) 20%, transparent); }
.preview-pane { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.4rem; margin-top: .8rem; }
.editor-side { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 1rem; }
.editor-actions { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; }
.editor-actions button { width: 100%; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: .5rem; cursor: pointer; }
.editor-actions button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.editor-actions button.warn { color: #8a5a00; }
.editor-actions button.danger, button.danger { color: #a02020; border-color: #f2bcbc; background: #fff; }
button.small { font-size: .8rem; padding: .2rem .5rem; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.media-item { margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.media-item img, .media-item video { width: 100%; height: 140px; object-fit: cover; display: block; }
.media-item figcaption { padding: .5rem; font-size: .8rem; display: flex; justify-content: space-between; align-items: center; gap: .4rem; }
.media-item code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }
.logo-preview { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; margin-top: .5rem; }

/* Domovina SSO login */
#sso-box #sso-magic { width: 100%; }
.sso-or { display: flex; align-items: center; gap: .75rem; color: var(--muted, #888); margin: 1.1rem 0; font-size: .85rem; }
.sso-or::before, .sso-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
button.secondary { width: 100%; background: #fff; color: var(--ink); border: 1px solid var(--line); }
button.secondary:hover { opacity: .92; }
#sso-status:not([hidden]) { display: block; }

/* Google sign-in button (službeni izgled: bijela pozadina, G logo) */
.btn-google {
  width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: .65rem;
  background: #fff; color: #3c4043; border: 1px solid #dadce0; border-radius: 8px;
  padding: .65rem 1rem; font-size: .95rem; font-weight: 500; line-height: 1; cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.btn-google:hover { background: #f7f8f9; box-shadow: 0 1px 3px rgba(60,64,67,.18); border-color: #d2d5d9; }
.btn-google:active { background: #eef0f2; }
.btn-google .g-logo { flex: 0 0 auto; display: block; }
