@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=Inter:wght@400;500;700&display=swap');

@layer tokens, base, layout, components, utilities;

@layer tokens {
  :root {
    --brand: #d97706;
    --brand-dark: #92400e;
    --bg: #fff7ed;
    --bg-elevated: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: rgba(120, 53, 15, 0.12);
    --radius: 1.25rem;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    --font-heading: "Playfair Display", Georgia, serif;
    --font-body: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --heading-case: none;
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 3rem;
    --container: 1120px;
  }
}

@layer base {
  *, *::before, *::after { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
  }
  h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    text-transform: var(--heading-case);
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0 0 var(--space-md);
  }
  a { color: var(--brand); text-decoration: none; }
  a:hover { color: var(--brand-dark); text-decoration: underline; }
  img { max-width: 100%; height: auto; display: block; }
  p, ul, ol { margin: 0 0 var(--space-md); }
  ul, ol { padding-left: var(--space-lg); }
  input, button, textarea { font: inherit; }
}

@layer layout {
  .container { width: min(var(--container), 94%); margin-inline: auto; }
  .grid { display: grid; gap: var(--space-lg); grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
  .flex { display: flex; gap: var(--space-md); align-items: center; }
  .flex-between { justify-content: space-between; }
  .flex-wrap { flex-wrap: wrap; }
  .text-center { text-align: center; }
  .section { padding-block: var(--space-xl); }
  .section-alt { background: var(--bg-elevated); border-block: 1px solid var(--border); }
}

@layer components {
  .site-header {
    position: fixed;
    inset-inline: 0;
    top: 0;
    z-index: 100;
    background: rgba(255, 247, 237, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
  }
  .site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    gap: var(--space-md);
  }
  .site-header .logo img { height: 36px; width: auto; }
  .site-nav { display: flex; gap: var(--space-lg); font-weight: 600; }
  .site-nav a { color: var(--text); }
  .site-nav a:hover { color: var(--brand); }

  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  }
  .btn:hover { transform: translateY(-2px); text-decoration: none; }
  .btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
  .btn-primary:hover { background: var(--brand-dark); color: #fff; }
  .btn-secondary { background: transparent; color: var(--brand); border-color: var(--brand); }
  .btn-secondary:hover { background: var(--brand); color: #fff; }

  .hero {
    position: relative;
    min-height: 92vh;
    display: grid;
    align-items: center;
    padding-block: 6rem 3rem;
    overflow: hidden;
  }
  .hero__bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    z-index: -2;
  }
  .hero__overlay {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(to right, rgba(255, 247, 237, 0.96), rgba(255, 247, 237, 0.72));
  }
  .hero__inner {
    display: grid;
    gap: var(--space-xl);
    align-items: center;
    position: relative;
    z-index: 1;
  }
  .hero--split .hero__inner { grid-template-columns: 1fr 1fr; }
  .hero--full { align-items: end; padding-bottom: 4rem; }
  .hero--full .hero__inner { max-width: 760px; justify-items: start; }
  .hero h1 { font-size: clamp(2.5rem, 6vw, 5rem); margin-bottom: var(--space-md); }
  .hero p { font-size: 1.25rem; color: var(--text-muted); margin-bottom: var(--space-lg); max-width: 560px; }
  .hero__image { border-radius: var(--radius); box-shadow: var(--shadow); object-fit: cover; width: 100%; max-height: 600px; }

  .search-box {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.5rem;
    background: #ffffff;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    max-width: 560px;
  }
  .search-box__input {
    flex: 1 1 220px;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: #f8fafc;
    color: var(--text);
    font-size: 1rem;
  }
  .search-box__input:focus { outline: 2px solid var(--brand); border-color: transparent; }

  .tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    background: color-mix(in oklab, var(--brand) 12%, transparent);
    color: var(--brand);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
  }
  .card:hover { transform: translateY(-4px); box-shadow: 0 16px 32px rgba(0, 0, 0, 0.12); }
  .card__link { display: block; overflow: hidden; }
  .card__image { width: 100%; height: 220px; object-fit: cover; transition: transform 0.4s; }
  .card:hover .card__image { transform: scale(1.05); }
  .card__body { padding: var(--space-lg); display: flex; flex-direction: column; flex: 1; }
  .card__title { font-size: 1.5rem; margin: 0.5rem 0 0.75rem; }
  .card__title a { color: var(--text); }
  .card__title a:hover { color: var(--brand); text-decoration: none; }
  .card__excerpt { color: var(--text-muted); margin-bottom: var(--space-lg); flex: 1; }
  .card__footer {
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: var(--space-md);
    margin-top: auto;
    display: flex;
    justify-content: space-between;
  }

  .newsletter {
    padding-block: var(--space-xl);
    background: #0f172a;
    color: #f8fafc;
  }
  .newsletter h2 { color: #f8fafc; margin-bottom: 0.5rem; }
  .newsletter p { color: #f8fafc; opacity: 0.8; margin-bottom: var(--space-lg); }
  .newsletter form { display: flex; gap: 0.5rem; flex-wrap: wrap; max-width: 480px; }
  .newsletter input {
    flex: 1 1 200px;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
  }
  .newsletter input::placeholder { color: #f8fafc; opacity: 0.6; }
  .newsletter button { margin: 0; }

  .site-footer {
    padding-block: var(--space-lg);
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
  }
  .site-footer a { color: var(--text-muted); }
  .site-footer a:hover { color: var(--brand); }

  .post-hero {
    min-height: 55vh;
    display: grid;
    align-items: end;
    padding-block: 4rem;
    background-size: cover;
    background-position: center;
    position: relative;
    color: #fff;
  }
  .post-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.3));
  }
  .post-hero .container { position: relative; }
  .post-hero__tags { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: var(--space-md); }
  .post-hero h1 { color: #fff; font-size: clamp(2.2rem, 5vw, 4.5rem); margin-bottom: var(--space-md); }
  .post-hero__meta { opacity: 0.85; font-size: 0.95rem; }

  .post-body { padding-block: var(--space-xl); }
  .prose { max-width: 720px; margin-inline: auto; line-height: 1.75; }
  .prose h2 { font-size: 2rem; margin-top: 2.5rem; margin-bottom: var(--space-md); color: var(--text); }
  .prose h3 { font-size: 1.5rem; margin-top: 2rem; margin-bottom: 0.75rem; color: var(--text); }
  .prose p, .prose ul, .prose ol { margin-bottom: var(--space-md); color: var(--text-muted); }
  .prose a { color: var(--brand); text-decoration: underline; text-underline-offset: 0.2em; }
  .prose img { border-radius: var(--radius); margin-block: 2rem; }
  .prose blockquote { border-left: 4px solid var(--brand); padding-left: var(--space-md); font-style: italic; color: var(--text-muted); margin: 2rem 0; }

  .cta-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-xl);
    margin-top: var(--space-xl);
    text-align: center;
  }
  .cta-card h3 { margin-bottom: 0.5rem; }
  .cta-card p { color: var(--text-muted); margin-bottom: var(--space-lg); }
}

@layer utilities {
  .visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
}

@media (max-width: 768px) {
  .hero--split .hero__inner { grid-template-columns: 1fr; }
  .hero__image { max-height: 360px; }
  .grid { grid-template-columns: 1fr; }
  .site-nav { display: none; }
  .site-header__inner { flex-wrap: wrap; }
}
