/* ============================================================
     SMAŽINKA — typography-first minimal blog
     ============================================================ */

  :root {
    --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
    --mono: "JetBrains Mono", ui-monospace, "SF Mono", "Menlo", monospace;

    --measure: 38rem;
    --pad: clamp(1.5rem, 5vw, 3rem);
    --step: 1.6;
  }

  /* ---- Light: warm paper ---- */
  html[data-theme="light"] {
    --bg:        #f7f5ef;
    --bg-soft:   #efece3;
    --surface:   #fcfbf7;
    --ink:       #20201d;
    --ink-soft:  #56544d;
    --ink-faint: #8a877d;
    --line:      #e2ddd1;
    --line-soft: #ebe7dc;
    --accent:    #9a3b1f;
    --selection: #e8e0cd;
  }

  /* ---- Dark: slate / zinc ---- */
  html[data-theme="dark"] {
    --bg:        #161719;
    --bg-soft:   #1d1f22;
    --surface:   #1b1d20;
    --ink:       #e7e7e4;
    --ink-soft:  #a4a39d;
    --ink-faint: #6f6e69;
    --line:      #2b2d30;
    --line-soft: #232528;
    --accent:    #e0a07a;
    --selection: #33373b;
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }

  html {
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
  }

  body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--serif);
    font-size: 19px;
    line-height: var(--step);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-feature-settings: "kern", "liga", "onum";
    min-height: 100vh;
    transition: background .4s ease, color .4s ease;
  }

  ::selection { background: var(--selection); }

  a { color: inherit; text-decoration: none; }

  /* ---------- shell ---------- */
  .wrap {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 0 var(--pad);
  }
  .wrap--wide { max-width: 72rem; }

  /* ---------- top bar ---------- */
  header.bar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: saturate(140%) blur(10px);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    border-bottom: 1px solid transparent;
    transition: border-color .3s ease, background .4s ease;
  }
  header.bar.scrolled { border-bottom-color: var(--line); }

  .bar-inner {
    max-width: 72rem;
    margin: 0 auto;
    padding: .85rem var(--pad);
    display: flex;
    align-items: baseline;
    gap: 1.4rem;
  }

  .brand {
    font-weight: 600;
    font-size: 1.12rem;
    letter-spacing: -0.01em;
    cursor: pointer;
    display: inline-flex;
    align-items: baseline;
    gap: .55rem;
  }
  .brand .dot {
    width: .42rem; height: .42rem;
    border-radius: 50%;
    background: var(--accent);
    transform: translateY(-1px);
    flex: none;
  }
  .brand .sub {
    font-family: var(--mono);
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .18em;
    color: var(--ink-faint);
    font-weight: 400;
  }

  nav.links {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .35rem;
  }
  .navlink {
    font-family: var(--mono);
    font-size: .68rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ink-soft);
    padding: .5rem .7rem;
    border-radius: 7px;
    cursor: pointer;
    transition: color .2s, background .2s;
    line-height: 1;
  }
  .navlink:hover { color: var(--ink); background: var(--bg-soft); }
  .navlink.active { color: var(--ink); }
  .navlink.active::after {
    content: "";
    display: block;
    height: 1px;
    background: var(--accent);
    margin-top: .35rem;
    border-radius: 1px;
  }

  .toggle {
    width: 34px; height: 34px;
    display: grid; place-items: center;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 9px;
    cursor: pointer;
    color: var(--ink-soft);
    transition: color .2s, border-color .2s, transform .3s;
  }
  .toggle:hover { color: var(--ink); border-color: var(--ink-faint); }
  .toggle:active { transform: scale(.92); }
  .toggle svg { width: 16px; height: 16px; display: block; }
  html[data-theme="dark"] .toggle .ico-sun { display: block; }
  html[data-theme="dark"] .toggle .ico-moon { display: none; }
  html[data-theme="light"] .toggle .ico-sun { display: none; }
  html[data-theme="light"] .toggle .ico-moon { display: block; }

  /* ---------- view transitions ---------- */
  main { padding-bottom: 6rem; }
  .view { display: none; }
  .view.show { display: block; animation: rise .5s cubic-bezier(.2,.7,.2,1); }
  @keyframes rise {
    from { transform: translateY(9px); }
    to   { transform: none; }
  }
  @media (prefers-reduced-motion: reduce) {
    .view.show { animation: none; }
  }

  /* ---------- home: masthead / bio ---------- */
  .masthead {
    padding: clamp(3.5rem, 9vw, 6rem) 0 2.2rem;
    border-bottom: 1px solid var(--line-soft);
  }
  .masthead h1 {
    font-weight: 500;
    font-size: clamp(2.7rem, 8vw, 4.3rem);
    line-height: 1.02;
    letter-spacing: -0.035em;
    margin-bottom: 1.4rem;
  }
  .masthead h1 em { font-style: italic; color: var(--ink-soft); }
  .bio {
    font-size: 1.18rem;
    line-height: 1.65;
    color: var(--ink-soft);
    max-width: 32rem;
  }
  .bio a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); transition: text-decoration-color .2s; }
  .bio a:hover { text-decoration-color: var(--accent); }

  /* ---------- post list ---------- */
  .list-label {
    font-family: var(--mono);
    font-size: .66rem;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--ink-faint);
    padding: 2.4rem 0 .4rem;
  }
  .post-row {
    display: block;
    padding: 1.7rem 0;
    border-bottom: 1px solid var(--line-soft);
    cursor: pointer;
    position: relative;
  }
  .post-row:last-child { border-bottom: 0; }
  .post-row .meta {
    font-family: var(--mono);
    font-size: .68rem;
    letter-spacing: .06em;
    color: var(--ink-faint);
    text-transform: uppercase;
    margin-bottom: .5rem;
    display: flex;
    gap: .9rem;
    align-items: center;
  }
  .post-row .meta .sep { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }
  .post-row h2 {
    font-weight: 500;
    font-size: 1.62rem;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: .5rem;
    transition: color .2s;
    display: inline;
    background-image: linear-gradient(var(--accent), var(--accent));
    background-size: 0% 1px;
    background-position: 0 1.05em;
    background-repeat: no-repeat;
    transition: background-size .35s cubic-bezier(.2,.7,.2,1);
  }
  .post-row:hover h2 { background-size: 100% 1px; }
  .post-row .excerpt {
    color: var(--ink-soft);
    font-size: 1.05rem;
    line-height: 1.6;
    margin-top: .55rem;
    max-width: 34rem;
  }
  .post-row .arrow {
    position: absolute;
    right: 0; top: 1.7rem;
    font-family: var(--mono);
    color: var(--ink-faint);
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity .25s, transform .25s, color .2s;
  }
  .post-row:hover .arrow { opacity: 1; transform: none; color: var(--accent); }

  .colophon {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--line-soft);
    font-family: var(--mono);
    font-size: .68rem;
    color: var(--ink-faint);
    letter-spacing: .04em;
    line-height: 1.9;
  }

  /* ---------- article ---------- */
  .back {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-family: var(--mono);
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--ink-soft);
    margin: 2.8rem 0 0;
    cursor: pointer;
    transition: color .2s, gap .2s;
  }
  .back:hover { color: var(--ink); gap: .75rem; }

  article { padding-top: 2.4rem; }
  .art-head {
    margin-bottom: 2.8rem;
    padding-bottom: 2.2rem;
    border-bottom: 1px solid var(--line-soft);
  }
  .art-head .meta {
    font-family: var(--mono);
    font-size: .68rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-faint);
    display: flex;
    gap: .9rem;
    align-items: center;
    margin-bottom: 1.3rem;
  }
  .art-head .meta .sep { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }
  .art-head h1 {
    font-weight: 500;
    font-size: clamp(2.1rem, 6vw, 3.1rem);
    line-height: 1.08;
    letter-spacing: -0.03em;
  }

  /* ---------- the prose engine (shared by article + preview) ---------- */
  .prose { font-size: 1.18rem; line-height: 1.72; }
  .prose > * + * { margin-top: 1.35rem; }
  .prose h1, .prose h2, .prose h3 {
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
  }
  .prose h1 { font-size: 1.9rem; margin-top: 3rem; }
  .prose h2 { font-size: 1.5rem; margin-top: 2.6rem; }
  .prose h3 { font-size: 1.2rem; margin-top: 2.2rem; color: var(--ink-soft); }
  .prose h2 + *, .prose h3 + *, .prose h1 + * { margin-top: 1rem; }
  .prose p { text-wrap: pretty; }
  .prose a {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--accent);
    text-decoration-thickness: 1px;
    transition: color .2s;
  }
  .prose a:hover { color: var(--accent); }
  .prose strong { font-weight: 600; }
  .prose em { font-style: italic; }
  .prose ul, .prose ol { padding-left: 1.4rem; }
  .prose li { margin-top: .5rem; padding-left: .3rem; }
  .prose li::marker { color: var(--ink-faint); }
  .prose ul li::marker { content: "–  "; }
  .prose blockquote {
    border-left: 2px solid var(--accent);
    padding: .2rem 0 .2rem 1.4rem;
    margin-left: 0;
    font-style: italic;
    color: var(--ink-soft);
    font-size: 1.22rem;
  }
  .prose blockquote p { margin-top: .6rem; }
  .prose hr {
    border: 0;
    text-align: center;
    margin: 2.6rem 0;
  }
  .prose hr::before {
    content: "* * *";
    letter-spacing: .6em;
    color: var(--ink-faint);
    font-size: .9rem;
  }
  .prose code {
    font-family: var(--mono);
    font-size: .82em;
    background: var(--bg-soft);
    border: 1px solid var(--line-soft);
    padding: .12em .4em;
    border-radius: 5px;
  }
  .prose pre {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 1.1rem 1.25rem;
    overflow-x: auto;
    font-size: .82rem;
    line-height: 1.65;
  }
  .prose pre code {
    background: none; border: 0; padding: 0; font-size: inherit;
  }
  .prose img { max-width: 100%; border-radius: 10px; }
  .art-foot {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--line-soft);
    font-family: var(--mono);
    font-size: .68rem;
    letter-spacing: .04em;
    color: var(--ink-faint);
  }

  /* ---------- admin / editor ---------- */
  .editor-head {
    padding: clamp(2.4rem, 6vw, 3.6rem) 0 1.6rem;
  }
  .editor-head h1 {
    font-weight: 500;
    font-size: clamp(1.9rem, 5vw, 2.6rem);
    letter-spacing: -0.03em;
    margin-bottom: .6rem;
  }
  .editor-head p {
    color: var(--ink-soft);
    max-width: 36rem;
    font-size: 1.05rem;
  }
  .editor-head p code {
    font-family: var(--mono); font-size: .8em;
    background: var(--bg-soft); border: 1px solid var(--line-soft);
    padding: .1em .4em; border-radius: 5px;
  }

  .split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: start;
  }
  .pane {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    overflow: hidden;
    min-height: 60vh;
    display: flex;
    flex-direction: column;
  }
  .pane-bar {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .7rem 1rem;
    border-bottom: 1px solid var(--line-soft);
    font-family: var(--mono);
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .16em;
    color: var(--ink-faint);
    background: var(--bg-soft);
  }
  .pane-bar .dotrow { display: flex; gap: .3rem; }
  .pane-bar .dotrow i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); display: block; }
  .pane-bar .count { margin-left: auto; text-transform: none; letter-spacing: .04em; }

  #editor {
    flex: 1;
    width: 100%;
    border: 0;
    outline: 0;
    resize: none;
    background: transparent;
    color: var(--ink);
    font-family: var(--mono);
    font-size: .86rem;
    line-height: 1.7;
    padding: 1.25rem 1.4rem;
    tab-size: 2;
  }
  #editor::placeholder { color: var(--ink-faint); }

  #editor-slug:is(:focus, :focus-visible){
    outline: none;
  }

  #editor-slug:empty::after{
    content: "url-pribehu";
    color: var(--ink-faint);
  }

  #editor-slug:empty:is(:focus, :focus-visible)::after{
    content: "";
  }

  .preview-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1.6rem 2.2rem;
  }
  /* front-matter card rendered above preview prose */
  .fm-card {
    border: 1px dashed var(--line);
    border-radius: 10px;
    padding: .9rem 1.1rem;
    margin-bottom: 1.6rem;
    background: var(--bg-soft);
  }
  .fm-card .fm-title {
    font-weight: 600; font-size: 1.35rem; letter-spacing: -0.02em;
    line-height: 1.2; margin-bottom: .4rem;
  }
  .fm-card .fm-meta {
    font-family: var(--mono); font-size: .64rem;
    text-transform: uppercase; letter-spacing: .08em;
    color: var(--ink-faint);
    display: flex; flex-wrap: wrap; gap: .5rem .9rem;
  }
  .fm-card .fm-meta b { color: var(--ink-soft); font-weight: 500; }
  .fm-missing {
    font-family: var(--mono); font-size: .72rem;
    color: var(--ink-faint); font-style: normal;
  }

  @media (max-width: 760px) {
    .split { grid-template-columns: 1fr; }
    .pane { min-height: 44vh; }
    body { font-size: 18px; }
    nav.links .navlink { padding: .5rem .5rem; }
  }
