/* Martin Kostov — personal site
   Minimal, premium, light-first with a dark-mode option.
   Green accent aligned with The Offline Years; the Books band echoes it directly. */

:root {
  --bg:        #f7f6f2;   /* warm off-white  */
  --surface:   #ffffff;
  --surface-2: #f1efe9;   /* alt band        */
  --ink:       #182420;   /* near-black, green-tinted */
  --muted:     #55635b;
  --dim:       #7c8880;
  --line:      rgba(24,36,32,.10);
  --line-2:    rgba(24,36,32,.16);
  --accent:    #1f7a55;   /* muted green      */
  --accent-ink:#0f3d2a;
  --accent-soft:rgba(31,122,85,.10);
  --accent-hover:#1a6b4a;
  --header-bg:  rgba(247,246,242,.82);

  /* Offline Years palette, reused for the Books band */
  --oy-bg:     #15291d;
  --oy-panel:  #0e1c14;
  --oy-ink:    #ece3cd;
  --oy-gold:   #cdbf99;
  --oy-accent: #5fe08a;

  --maxw: 1080px;
  --radius: 14px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0f1613;
    --surface:   #141d18;
    --surface-2: #101815;
    --ink:       #e7ede9;
    --muted:     #a7b3ac;
    --dim:       #7f8d85;
    --line:      rgba(231,237,233,.10);
    --line-2:    rgba(231,237,233,.16);
    --accent:    #5fe08a;
    --accent-ink:#0c1711;
    --accent-soft:rgba(95,224,138,.12);
    --accent-hover:#4fcf7b;
    --header-bg:  rgba(15,22,19,.82);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  scroll-padding-top: 72px;
}

/* soft top gradient wash */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 420px;
  background: radial-gradient(120% 100% at 50% -20%, var(--accent-soft), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 100;
}
.skip:focus { left: 0; text-decoration: none; }

/* ---------- Header ---------- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(18px, 5vw, 40px);
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .04em;
}
.brand-name { font-weight: 600; letter-spacing: -.01em; }
.site-nav { display: flex; gap: clamp(10px, 2.4vw, 26px); }
.site-nav a { color: var(--muted); font-size: 14.5px; }
.site-nav a:hover { color: var(--ink); text-decoration: none; }
@media (max-width: 720px) { .site-nav { gap: 14px; font-size: 14px; } }
@media (max-width: 600px) {
  /* Wordmark on the first row; nav wraps to a full-width second row so it always fits. */
  .site-head { flex-wrap: wrap; row-gap: 8px; }
  .site-nav { width: 100%; justify-content: space-between; gap: 8px; font-size: 13.5px; }
}

/* ---------- Layout ---------- */
main { position: relative; z-index: 1; }
.inner { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(18px, 5vw, 40px); }
.inner-narrow { max-width: 720px; }

.section-title {
  font-size: 13px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 26px;
}

/* ---------- Hero ---------- */
.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(64px, 12vw, 120px) clamp(18px, 5vw, 40px) clamp(48px, 8vw, 84px);
}
.avatar {
  display: block;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0;
  border: 1px solid var(--line-2);
  box-shadow: 0 12px 34px -16px rgba(24,36,32,.55);
  background: var(--surface-2);
}
@media (max-width: 520px) { .avatar { width: 104px; height: 104px; } }

/* Photo beside the name */
.hero-head { display: flex; align-items: center; gap: clamp(16px, 3vw, 28px); margin: 0 0 22px; }
.hero-headings { min-width: 0; }
@media (max-width: 380px) { .hero-head { gap: 14px; } }

.eyebrow {
  margin: 0 0 10px;
  font-size: 13.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}
.hero h1 {
  margin: 0;
  font-size: clamp(44px, 9vw, 92px);
  line-height: 1.02;
  letter-spacing: -.03em;
  font-weight: 700;
}
.lede {
  margin: 22px 0 0;
  max-width: 20em;
  font-size: clamp(19px, 2.6vw, 26px);
  line-height: 1.45;
  color: var(--muted);
  font-weight: 400;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 34px 0 0; }
.hero-note { margin: 24px 0 0; font-size: 14px; color: var(--dim); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.btn:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
@media (prefers-reduced-motion: reduce) { .btn:hover { transform: none; } }

/* ---------- Bands ---------- */
.band { padding: clamp(56px, 9vw, 96px) 0; border-top: 1px solid var(--line); }
.band.alt { background: var(--surface-2); }

/* ---------- Cards ---------- */
.cards { display: grid; gap: 18px; }
.cards-4 { grid-template-columns: repeat(4, 1fr); }
.cards-3 { grid-template-columns: repeat(3, 1fr); }
.cards-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .cards-4, .cards-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .cards-4, .cards-3, .cards-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 22px 24px;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--line-2);
  box-shadow: 0 14px 40px -24px rgba(24,36,32,.5);
}
@media (prefers-reduced-motion: reduce) { .card:hover { transform: none; } }
.card h3 { margin: 0 0 8px; font-size: 18px; letter-spacing: -.01em; line-height: 1.3; }
.card p { margin: 0; color: var(--muted); font-size: 15.5px; }

.card-talk, .card-article { display: flex; flex-direction: column; }
.tag {
  align-self: flex-start;
  font-size: 11.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.card-link { margin-top: 16px; font-weight: 600; font-size: 15px; }
.band-cta { margin: 28px 0 0; }

/* ---------- Books (Offline Years echo) ---------- */
.books {
  background: var(--oy-bg);
  color: var(--oy-ink);
  border-top: 1px solid rgba(0,0,0,.3);
  padding: clamp(64px, 11vw, 120px) 0;
  text-align: center;
}
.books .inner { max-width: 720px; }
.books-eyebrow {
  margin: 0 0 14px;
  font-size: 12.5px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--oy-gold);
}
.books-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(38px, 7vw, 64px);
  line-height: 1.05;
  letter-spacing: .01em;
  font-weight: 600;
}
.books-lede {
  margin: 20px auto 0;
  max-width: 30em;
  font-family: var(--serif);
  font-size: clamp(18px, 2.4vw, 22px);
  color: var(--oy-gold);
  line-height: 1.55;
}
.books-note { margin: 18px 0 30px; font-size: 14px; letter-spacing: .02em; color: #9fb0a1; }
.btn-book {
  background: var(--oy-accent);
  color: #0c1711;
  border-color: var(--oy-accent);
  font-weight: 600;
}
.btn-book:hover { background: #4ecb7c; border-color: #4ecb7c; }

/* ---------- Bio ---------- */
.bio { padding: clamp(56px, 9vw, 96px) 0; }
.bio p { margin: 0 0 16px; font-size: 18px; color: var(--ink); }
.bio p:last-child { margin-bottom: 0; }
.bio em { font-style: italic; }

/* ---------- FAQ ---------- */
.faq-list { margin: 0; }
.faq-item { padding: 20px 0; border-top: 1px solid var(--line); }
.faq-item:first-child { border-top: none; padding-top: 0; }
.faq-item dt { font-weight: 600; font-size: 17px; margin: 0 0 6px; letter-spacing: -.01em; }
.faq-item dd { margin: 0; color: var(--muted); font-size: 15.5px; }
.faq-item dd a { color: var(--accent); }

/* ---------- Contact form ---------- */
.contact-intro { margin: 0 0 22px; color: var(--muted); font-size: 16px; }
.contact-form { display: flex; flex-direction: column; gap: 14px; }
.cf-row { display: flex; gap: 14px; }
@media (max-width: 560px) { .cf-row { flex-direction: column; } }
.cf-field { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.cf-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
  width: 100%;
  font: inherit;
  font-size: 15.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 11px 13px;
}
.contact-form textarea { resize: vertical; min-height: 120px; }
.contact-form input:focus, .contact-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.cf-consent { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.cf-consent input { margin-top: 3px; flex: none; }
.cf-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.cf-actions .btn { cursor: pointer; }
.cf-actions .btn:disabled { opacity: .6; cursor: default; }
.cf-status { margin: 0; font-size: 14px; }
.cf-status.cf-ok { color: var(--accent); }
.cf-status.cf-err { color: #d9544e; }
.cf-status.cf-pending { color: var(--muted); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Links / Contact ---------- */
.links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 760px) { .links { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { .links { grid-template-columns: 1fr; } }
.links a {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 13px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  transition: border-color .15s ease, transform .15s ease;
}
.links a:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .links a:hover { transform: none; } }
.lk-icon { width: 22px; height: 22px; flex: none; }
.lk-icon path { fill: var(--muted); transition: fill .15s ease; }
.links a:hover .lk-icon path { fill: var(--accent); }
.lk-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lk-name { font-weight: 600; }
.lk-sub { font-size: 13.5px; color: var(--dim); }

/* ---------- Footer ---------- */
.site-foot {
  border-top: 1px solid var(--line);
  padding: 34px clamp(18px, 5vw, 40px) 46px;
  text-align: center;
}
.foot-nav { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.foot-nav a { color: var(--muted); }
.foot-nav a:hover { color: var(--ink); }
.foot-line { margin: 0; font-size: 12.5px; letter-spacing: .06em; color: var(--dim); }

/* ---------- 404 ---------- */
.notfound { text-align: center; }
.notfound h1 { font-size: clamp(40px, 8vw, 72px); }
.notfound .lede { margin-left: auto; margin-right: auto; }
.notfound .hero-actions { justify-content: center; }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}
