/* ============================================
   Brian Dean — personal site
   Editorial, minimal, serif headlines, warm palette
   ============================================ */

:root {
  --bg: #faf8f4;
  --bg-alt: #f3efe7;
  --ink: #1a1a1a;
  --ink-soft: #4a4a48;
  --ink-mute: #6b6b68;
  --line: #e6e0d4;
  --accent: #b8472a;
  --accent-dark: #8e3620;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --max: 1080px;
  --max-narrow: 720px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  /* Respect the notch/rounded corners in landscape on iPhone */
  padding: 0 max(24px, env(safe-area-inset-right)) 0 max(24px, env(safe-area-inset-left));
}

/* Typography */
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.18; letter-spacing: -0.01em; color: var(--ink); }
.section-label, .eyebrow {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}
.section-label {
  font-size: clamp(22px, 2.6vw, 26px);
  letter-spacing: 0.04em;
}
.section-title { font-size: clamp(28px, 4vw, 40px); margin-bottom: 22px; }
.section-head { text-align: center; margin-bottom: 56px; }
.section-head .section-title { margin-bottom: 0; }
.link-arrow {
  font-weight: 500;
  color: var(--accent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.link-arrow:hover { border-color: var(--accent); }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 248, 244, 0.86);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  /* Keep the logo clear of the iPhone notch / status bar. The phone floor
     lives in the mobile media query below (some browsers report a zero
     safe-area inset even on notched devices, which hid the logo). */
  padding-top: env(safe-area-inset-top);
}
.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}
.logo {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.logo-dot { color: var(--accent); }
.main-nav { display: flex; gap: 32px; }
.main-nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  position: relative;
  transition: color 0.2s ease;
}
.main-nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -4px;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width 0.25s ease;
}
.main-nav a:hover { color: var(--ink); }
.main-nav a:hover::after { width: 100%; }
.nav-toggle { display: none; flex-direction: column; gap: 5px; padding: 8px; }
.nav-toggle span {
  width: 22px; height: 2px;
  background: var(--ink);
  transition: all 0.25s ease;
}

/* Hero */
.hero {
  border-bottom: 1px solid var(--line);
}
.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  align-items: stretch;
  min-height: clamp(500px, 72vh, 650px);
}
.hero-title {
  font-size: clamp(44px, 6.4vw, 92px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin-bottom: 0;
}
.hero-rule {
  width: 84px;
  height: 3px;
  border: 0;
  background: var(--accent);
  margin: 26px 0 30px;
}
.hero-sub {
  font-size: 19px;
  color: var(--ink-mute);
  max-width: 460px;
  margin: 0 0 32px;
}
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  padding: 14px 28px;
  border-radius: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--ink);
  color: var(--bg);
}
.btn-primary:hover { background: var(--accent); transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--ink); }
.btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--ink);
}
.btn-outline:hover { background: var(--ink); color: var(--bg); }

/* Sections */
.section { padding: 96px 0; border-bottom: 1px solid var(--line); }
.section:last-of-type { border-bottom: none; }

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 64px;
  align-items: center;
}
.portrait { display: flex; justify-content: center; }
.portrait-frame {
  width: 100%;
  max-width: 340px;
  aspect-ratio: 4 / 5;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-alt);
  box-shadow: 0 18px 50px -20px rgba(0,0,0,0.18);
}
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; }
.about-text p { color: var(--ink-soft); margin-bottom: 18px; font-size: 17px; }
.about-text .section-title { margin-bottom: 24px; }

/* Essay list */
.essay-list { display: flex; flex-direction: column; }
.essay-card {
  padding: 32px 0;
  border-top: 1px solid var(--line);
  transition: padding-left 0.25s ease;
}
.essay-card:last-of-type { border-bottom: 1px solid var(--line); }
.essay-card:hover { padding-left: 12px; }
.essay-meta {
  font-size: 13px;
  color: var(--ink-mute);
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}
.essay-title {
  font-size: 26px;
  margin-bottom: 10px;
  transition: color 0.2s ease;
}
.essay-card:hover .essay-title { color: var(--accent); }
.essay-excerpt { color: var(--ink-soft); font-size: 16px; max-width: 640px; }
.section-foot { text-align: center; margin-top: 40px; }

/* Newsletter */
.newsletter {
  background: var(--bg-alt);
  text-align: center;
}
.newsletter-inner { max-width: 640px; margin: 0 auto; }
.newsletter .section-title { font-size: clamp(28px, 4vw, 38px); margin-bottom: 18px; }
.newsletter-sub { color: var(--ink-soft); margin-bottom: 32px; font-size: 18px; }
.newsletter-form {
  display: flex;
  gap: 10px;
  max-width: 460px;
  margin: 0 auto 14px;
}
.newsletter-form input {
  flex: 1;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 15px;
  background: var(--bg);
  color: var(--ink);
  transition: border-color 0.2s ease;
}
.newsletter-form input:focus { outline: none; border-color: var(--ink); }
.newsletter-note { font-size: 13px; color: var(--ink-mute); }

/* Resources */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.resource-card {
  padding: 36px 30px;
  background: var(--bg-alt);
  border-radius: 10px;
  border: 1px solid transparent;
  transition: all 0.25s ease;
}
.resource-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 12px 30px -16px rgba(0,0,0,0.12);
}
.resource-title { font-size: 22px; margin-bottom: 12px; }
.resource-desc { color: var(--ink-soft); font-size: 15px; margin-bottom: 18px; }
.resource-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(184, 71, 42, 0.08);
  padding: 5px 10px;
  border-radius: 4px;
}

/* Contact */
.contact { text-align: center; }
.contact-inner { max-width: 580px; margin: 0 auto; }
.contact-sub { color: var(--ink-soft); margin-bottom: 28px; font-size: 18px; }

/* Narrow container for the single-column homepage sections */
.container.narrow { max-width: var(--max-narrow); }

/* Hero split layout */
.hero-portrait {
  position: relative;
  min-height: 100%;
  overflow: hidden;
  background: var(--bg-alt);
}
.hero-portrait img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}
.hero-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px clamp(28px, 6vw, 96px);
}
.hero-lede {
  font-family: var(--serif);
  font-size: clamp(21px, 2.4vw, 27px);
  line-height: 1.35;
  color: var(--ink);
  max-width: 520px;
  margin: 0 0 38px;
}

/* Background fact list */
.fact-list { list-style: none; display: flex; flex-direction: column; gap: 18px; }
.fact-list li {
  position: relative;
  padding-left: 26px;
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1.6;
}
.fact-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

/* Prose (Now section) */
.prose p { color: var(--ink-soft); font-size: 18px; line-height: 1.75; margin-bottom: 20px; }
.prose p:last-child { margin-bottom: 0; }
.prose a {
  color: var(--accent);
  border-bottom: 1px solid rgba(184, 71, 42, 0.35);
  transition: border-color 0.2s ease;
}
.prose a:hover { border-color: var(--accent); }

/* Footer */
.site-footer {
  background: #181816;
  color: #cfc9bd;
  padding: 56px 0;
}
.footer-simple {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}
.footer-copy { font-size: 14px; color: #8c8678; }
.footer-social { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 24px; }
.footer-social a {
  font-size: 14px;
  font-weight: 500;
  color: #cfc9bd;
  transition: color 0.2s ease;
}
.footer-social a:hover { color: var(--bg); }
.footer-contact { font-size: 14px; color: #8c8678; }
.footer-contact a {
  color: var(--bg);
  border-bottom: 1px solid #3a3a34;
  transition: border-color 0.2s ease;
}
.footer-contact a:hover { border-color: var(--accent); }
.footer-legal { display: flex; justify-content: center; gap: 10px 24px; }
.footer-legal a {
  font-size: 14px;
  font-weight: 500;
  color: #8c8678;
  transition: color 0.2s ease;
}
.footer-legal a:hover { color: var(--bg); }


/* ============================================
   Writing page
   ============================================ */
.page-hero {
  padding: 80px 0 56px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.page-hero h1 { font-size: clamp(36px, 5vw, 52px); margin-bottom: 14px; }
.page-hero p { color: var(--ink-soft); font-size: 18px; max-width: 540px; margin: 0 auto; }
.essay-archive { padding: 72px 0 96px; }
.archive-list { max-width: var(--max-narrow); margin: 0 auto; }
.archive-item {
  padding: 28px 0;
  border-top: 1px solid var(--line);
  display: block;
  transition: padding-left 0.25s ease;
}
.archive-item:last-child { border-bottom: 1px solid var(--line); }
.archive-item:hover { padding-left: 12px; }
.archive-item h3 { font-size: 24px; margin-bottom: 8px; transition: color 0.2s ease; }
.archive-item:hover h3 { color: var(--accent); }
.archive-item .essay-meta { margin-bottom: 6px; }
.archive-item p { color: var(--ink-soft); font-size: 16px; }

/* ============================================
   About page
   ============================================ */
.about-page { padding: 80px 0 96px; }
.about-page-inner { max-width: var(--max-narrow); margin: 0 auto; }
.about-page .portrait-frame {
  max-width: 460px;
  aspect-ratio: 1 / 1;
  margin: 0 auto 48px;
}
.about-page h1 {
  font-size: clamp(36px, 5vw, 50px);
  text-align: center;
  margin-bottom: 40px;
}
.about-page .prose p { color: var(--ink-soft); font-size: 18px; margin-bottom: 22px; line-height: 1.75; }
.about-page .prose h2 {
  font-size: 26px;
  margin: 48px 0 20px;
  color: var(--ink);
}
.about-page .prose h2:first-child { margin-top: 0; }

/* ============================================
   Media page
   ============================================ */
.main-nav a.is-active { color: var(--ink); }
.main-nav a.is-active::after { width: 100%; }

.media-hero { padding: 72px 0 8px; }
.media-hero .hero-title { font-size: clamp(46px, 7vw, 96px); }
.media-hero .hero-rule { margin: 18px 0 26px; }
.media-hero-sub {
  color: var(--ink-soft);
  font-size: 19px;
  max-width: 520px;
}

.media-featured { padding: 40px 0 72px; }
.featured-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}
.featured-media {
  position: relative;
  display: block;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--bg-alt);
  box-shadow: 0 20px 50px -24px rgba(0,0,0,0.28);
}
.featured-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.featured-media:hover img { transform: scale(1.03); }
.play-button {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 68px; height: 68px;
  border-radius: 50%;
  background: rgba(20, 20, 18, 0.82);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 4px;
  transition: background 0.2s ease, transform 0.2s ease;
}
.featured-media:hover .play-button {
  background: var(--accent);
  transform: translate(-50%, -50%) scale(1.06);
}

.featured-body { max-width: 460px; }
.featured-show {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 16px;
}
.featured-title {
  font-size: clamp(30px, 3.4vw, 40px);
  line-height: 1.12;
  margin-bottom: 18px;
}
.featured-desc {
  color: var(--ink-soft);
  font-size: 18px;
  margin-bottom: 18px;
}
.featured-tag {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 26px;
}
.featured-cta { display: inline-flex; align-items: center; gap: 10px; }

.media-appearances { padding: 0; }
.appearances-title {
  font-size: clamp(28px, 3.4vw, 36px);
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}
.appearance-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
.appearance-card {
  display: flex;
  flex-direction: column;
  padding: 32px 34px 34px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  min-height: 220px;
  transition: background 0.2s ease;
}
.appearance-card:nth-child(3n) { border-right: none; }
.appearance-card:last-child { border-right: none; }
.appearance-card:hover { background: var(--bg-alt); }
.appearance-source {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 4px;
}
.appearance-type {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}
.appearance-headline {
  font-size: 24px;
  line-height: 1.2;
  margin-bottom: 24px;
  transition: color 0.2s ease;
}
.appearance-card:hover .appearance-headline { color: var(--accent); }
.appearance-link {
  margin-top: auto;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.appearance-link span { transition: transform 0.2s ease; }
.appearance-card:hover .appearance-link span { transform: translateX(4px); }

/* Media inquiries CTA */
.media-cta { padding: 48px 0 104px; }
.media-cta-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}
.media-cta-text .eyebrow { margin-bottom: 14px; }
.media-cta-title {
  font-size: clamp(26px, 3vw, 34px);
  margin-bottom: 8px;
}
.media-cta-sub {
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink-mute);
}
.media-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; gap: 40px; }
  .portrait { order: -1; }
  .portrait-frame { max-width: 260px; }
  .resource-grid { grid-template-columns: 1fr; }
  .hero-inner {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .hero-portrait {
    aspect-ratio: 4 / 3;
    min-height: 0;
  }
  .hero-content {
    padding: 56px clamp(24px, 6vw, 64px) 60px;
    max-width: 620px;
  }
  .featured-grid { grid-template-columns: 1fr; gap: 32px; }
  .featured-body { max-width: none; }
  .appearance-grid { grid-template-columns: 1fr; }
  .appearance-card {
    border-right: none;
    min-height: 0;
    padding: 28px 4px;
  }
  .media-cta-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
  }
}

@media (max-width: 640px) {
  /* On phones, guarantee the logo clears the notch / status bar / browser
     top chrome even when the browser reports safe-area-inset-top as 0
     (observed in the Google app's in-app browser and some Safari states).
     Falls back to the real inset when it is larger than the 44px floor. */
  .site-header { padding-top: max(env(safe-area-inset-top), 44px); }
  .main-nav {
    position: fixed;
    top: calc(68px + max(env(safe-area-inset-top), 44px)); left: 0; right: 0;
    background: var(--bg);
    flex-direction: column;
    gap: 0;
    padding: 8px 0 20px;
    border-bottom: 1px solid var(--line);
    /* Fully hide the closed menu. Relying on the slide transform alone left
       the bottom of the stacked menu (the "Media" link) poking back over the
       header and painting on top of the logo — visibility guarantees it never
       renders until opened, whatever the safe-area inset works out to. */
    transform: translateY(-130%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
    box-shadow: 0 12px 30px -16px rgba(0,0,0,0.14);
  }
  .main-nav.open { transform: translateY(0); opacity: 1; visibility: visible; }
  .main-nav a { padding: 14px 24px; width: 100%; }
  .main-nav a::after { display: none; }
  .nav-toggle { display: flex; }
  .nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle.open span:nth-child(2) { opacity: 0; }
  .nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .hero-portrait { aspect-ratio: 1 / 1; }
  .hero-content { padding: 44px 24px 52px; }
  .section { padding: 64px 0; }
  .section-head { margin-bottom: 40px; }
  .newsletter-form { flex-direction: column; }
  .newsletter-form input { width: 100%; }
  .essay-title { font-size: 22px; }
  .essay-card { padding: 24px 0; }
}

/* Mobile nav active state */
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
