/* ─────────────────────────────────────────
   LAPIS INSIDE — style.css
   ───────────────────────────────────────── */

:root {
  --navy:          #12234a;
  --navy-mid:      #1a3060;
  --navy-light:    #2a4a80;
  --blue-accent:   #4a6aaa;
  --gold:          #c5a55a;
  --charcoal:      #2d2d2d;
  --ink:           #1a1a1a;
  --slate:         #3a3f4a;
  --smoke:         #6a7a95;
  --silver:        #c0cad8;
  --parchment:     #F4F2EE;
  --off-white:     #f8f6f2;
  --white:         #ffffff;
  --rule:          #dedad4;
  --light-blue:    #dce6f7;
  --label-on-dark: #a8bce0;
  --body-on-dark:  #c8d8ee;

  /* Post type colours */
  --field-note:  #12234a;
  --question:    #2a4a80;
  --resource:    #5a7a3a;
  --long-read:   #5a3a6a;

  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans:  'Jost', sans-serif;
  --max-w: 1100px;
  --nav-h: 68px;

  --text-xs:   clamp(12px, 0.8vw + 9px,  14px);
  --text-sm:   clamp(14px, 0.9vw + 11px, 16px);
  --text-base: clamp(16px, 1.0vw + 13px, 18px);
  --text-md:   clamp(18px, 1.2vw + 14px, 21px);
  --text-lg:   clamp(21px, 1.8vw + 15px, 27px);
  --text-xl:   clamp(27px, 3.0vw + 17px, 40px);
  --text-2xl:  clamp(36px, 5.0vw + 18px, 54px);
  --label-sz:  clamp(11px, 0.7vw + 9px,  14px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--off-white);
  font-family: var(--font-sans);
  font-weight: 300;
  color: var(--ink);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
p { font-size: var(--text-base); line-height: 1.8; }
h1 { font-family: var(--font-serif); font-size: var(--text-2xl); font-weight: 400; line-height: 1.12; }
h2 { font-family: var(--font-serif); font-size: var(--text-xl);  font-weight: 400; line-height: 1.15; }
h3 { font-family: var(--font-serif); font-size: var(--text-lg);  font-weight: 500; line-height: 1.2; }

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 64px);
}

.section-label {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: var(--label-sz);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--label-on-dark);
  margin-bottom: 16px;
}

.btn-primary {
  display: inline-block;
  background: var(--navy);
  color: var(--light-blue);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: clamp(11px, 0.8vw + 8px, 13px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 14px 28px;
  border: 1px solid var(--navy);
  cursor: pointer;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--navy-mid); }

/* ── PASSWORD GATE ── */
.gate {
  min-height: 100vh;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.gate-inner {
  max-width: 440px;
  width: 100%;
}
.gate-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 48px;
}
.logo-mark {
  width: 40px; height: 40px;
  background: var(--navy-mid);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif);
  font-weight: 600; font-size: 24px;
  color: var(--light-blue);
  flex-shrink: 0;
}
.logo-mark.sm { width: 30px; height: 30px; font-size: 18px; }
.gate-wordmark { display: flex; flex-direction: column; gap: 3px; }
.gate-name {
  font-family: var(--font-serif);
  font-weight: 600; font-size: 19px;
  color: var(--light-blue); line-height: 1;
}
.gate-sub {
  font-size: 9px; letter-spacing: 0.28em;
  text-transform: uppercase; color: var(--smoke);
}
.gate-h1 {
  font-family: var(--font-serif);
  font-size: clamp(26px, 4vw, 38px);
  color: var(--light-blue);
  font-weight: 400;
  margin-bottom: 12px;
}
.gate-p {
  color: var(--body-on-dark);
  font-size: var(--text-base);
  margin-bottom: 36px;
}
.gate-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.gate-form input {
  flex: 1;
  min-width: 180px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--white);
  padding: 14px 16px;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  outline: none;
  transition: border-color 0.2s;
}
.gate-form input:focus { border-color: var(--light-blue); }
.gate-form input::placeholder { color: rgba(255,255,255,0.35); }
.gate-error {
  color: #f08080;
  font-size: var(--text-sm);
  margin-top: 12px;
  display: none;
}

/* ── NAV ── */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 200;
  background: var(--white);
  border-bottom: 1px solid var(--rule);
  height: var(--nav-h);
  transition: box-shadow 0.2s;
}
.nav.scrolled { box-shadow: 0 2px 24px rgba(18,35,74,0.07); }
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 64px);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo { display: flex; align-items: center; gap: 14px; }
.nav-vr { width: 1px; height: 26px; background: var(--silver); flex-shrink: 0; }
.nav-wordmark { display: flex; flex-direction: column; gap: 2px; }
.nav-name {
  font-family: var(--font-serif);
  font-weight: 600; font-size: 18px;
  color: var(--navy); line-height: 1;
}
.nav-sub {
  font-size: 8px; letter-spacing: 0.28em;
  text-transform: uppercase; color: var(--smoke);
}
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a, .filter-link {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate);
  transition: color 0.2s;
  cursor: pointer;
  border: none; background: none; padding: 0;
}
.nav-links a:hover, .filter-link:hover, .filter-link.active { color: var(--navy); }
.filter-link.active {
  color: var(--navy);
  border-bottom: 1px solid var(--gold);
  padding-bottom: 2px;
}
.nav-external { color: var(--smoke) !important; }
.nav-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 4px;
}
.nav-toggle span { display: block; width: 22px; height: 1px; background: var(--navy); }

/* ── HERO ── */
.hero {
  padding-top: calc(var(--nav-h) + 72px);
  padding-bottom: 64px;
  background: var(--navy);
}
.hero-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 64px);
  max-width: 760px;
}
.hero h1 { color: var(--light-blue); margin-bottom: 20px; }
.hero-sub {
  font-size: var(--text-md);
  color: var(--body-on-dark);
  line-height: 1.8;
}

/* ── POSTS SECTION ── */
.posts-section { padding: 56px 0 100px; }

/* Filter bar (mobile) */
.filter-bar {
  display: none;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--rule);
}
.filter-btn {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate);
  background: none;
  border: 1px solid var(--rule);
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn.active, .filter-btn:hover {
  background: var(--navy);
  color: var(--light-blue);
  border-color: var(--navy);
}

/* Posts grid */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}

.post-card {
  background: var(--white);
  padding: 36px 32px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 220px;
}
.post-card:hover { background: var(--off-white); }

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}
.post-type-badge {
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 3px 8px;
  font-family: var(--font-sans);
  font-weight: 400;
}
.post-type--field-note { background: #eef1f8; color: var(--navy); }
.post-type--question   { background: #eef4ff; color: var(--navy-light); }
.post-type--resource   { background: #f0f4ee; color: #3a5a2a; }
.post-type--long-read  { background: #f4eef8; color: #4a2a6a; }

.post-date {
  font-size: var(--text-xs);
  color: var(--smoke);
}

.post-card-title {
  font-family: var(--font-serif);
  font-size: clamp(17px, 1.2vw + 13px, 21px);
  color: var(--navy);
  font-weight: 500;
  line-height: 1.25;
  flex: 1;
}
.post-card--question .post-card-title {
  font-size: clamp(19px, 1.5vw + 14px, 24px);
  font-weight: 400;
  font-style: italic;
}

.post-card-body {
  font-size: var(--text-sm);
  color: var(--slate);
  line-height: 1.7;
}

.post-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
}
.post-card-link {
  font-size: var(--text-xs);
  color: var(--blue-accent);
  letter-spacing: 0.06em;
}
.post-read-more {
  font-size: var(--text-xs);
  color: var(--gold);
  margin-left: auto;
}

.loading, .empty-state, .error-state {
  padding: 80px 40px;
  text-align: center;
  color: var(--smoke);
  font-size: var(--text-sm);
  background: var(--white);
  grid-column: 1 / -1;
}

/* ── SINGLE POST ── */
.post-hero {
  padding-top: calc(var(--nav-h) + 64px);
  padding-bottom: 56px;
  background: var(--navy);
}
.post-hero-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 64px);
}
.post-hero-meta {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 20px;
}
.post-hero .post-date { color: var(--label-on-dark); }
.post-hero h1 {
  color: var(--light-blue);
  font-size: clamp(26px, 4vw, 42px);
}
.post-hero--question h1 { font-style: italic; font-weight: 400; }

.post-body-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 72px clamp(20px, 5vw, 64px) 100px;
  background: var(--white);
}
.post-body p {
  color: var(--charcoal);
  font-size: var(--text-base);
  line-height: 1.85;
  margin-bottom: 24px;
}
.post-link-block { margin-top: 40px; }
.post-nav {
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
}
.post-back {
  font-size: var(--text-sm);
  color: var(--smoke);
  transition: color 0.2s;
}
.post-back:hover { color: var(--navy); }

/* ── FOOTER ── */
.footer { background: var(--charcoal); padding: 48px 0; }
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 40px;
}
.footer-brand { max-width: 320px; }
.footer-logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.footer-logo .logo-mark { background: var(--navy-mid); }
.footer-name {
  font-family: var(--font-serif);
  font-weight: 600; font-size: 17px;
  color: var(--light-blue);
}
.footer-note { font-size: var(--text-xs); color: rgba(138,154,181,0.6); line-height: 1.6; }
.footer-links {
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
}
.footer-links a {
  font-size: var(--text-sm); color: rgba(138,154,181,0.7);
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--light-blue); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .posts-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-links .filter-link { display: none; }
  .filter-bar { display: flex; }
}
@media (max-width: 600px) {
  .posts-grid { grid-template-columns: 1fr; }
  .nav-wordmark { display: none; }
  .footer-inner { flex-direction: column; }
  .footer-links { align-items: flex-start; }
  .gate-form { flex-direction: column; }
}
