/* emilyberge.com — shared styles */

/* Fonts are self-hosted and free (SIL Open Font License).
   Cormorant Garamond = headings, name, titles (same as the Squarespace site).
   EB Garamond = body text (free stand-in for Adobe Garamond, which Squarespace licensed). */
@font-face { font-family: "Cormorant Garamond"; src: url("fonts/cormorant-garamond-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("fonts/cormorant-garamond-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("fonts/cormorant-garamond-latin-500-italic.woff2") format("woff2"); font-weight: 500; font-style: italic; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("fonts/eb-garamond-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("fonts/eb-garamond-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("fonts/eb-garamond-latin-500-normal.woff2") format("woff2"); font-weight: 500 700; font-style: normal; font-display: swap; }

:root {
  --display: "Cormorant Garamond", "EB Garamond", Garamond, serif;
  --serif: "EB Garamond", Garamond, "Times New Roman", serif;
  --bg: #ffffff;
  --ink: #000000;
  --muted: #5f5f5f;
  --rule: #d9d9d9;
  --card: #f1f1f1;
  --gutter: clamp(20px, 4vw, 56px);
}

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

html { background: var(--bg); }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}
a:hover { text-decoration-thickness: 2px; }

img { display: block; max-width: 100%; height: auto; }

h1, h2, h3 { font-family: var(--display); font-weight: 500; line-height: 1.22; }
h1 { font-size: clamp(40px, 4.7vw, 68px); }
h2 { font-size: clamp(30px, 2.6vw, 37px); }
h3 { font-size: clamp(26px, 2.2vw, 32px); }

p + p { margin-top: 0.9em; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */

.site-header {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 36px var(--gutter);
}
.site-header .name {
  font-family: var(--display);
  font-size: clamp(26px, 2.3vw, 33px);
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
}
.site-nav { display: flex; gap: 22px; font-size: 19px; line-height: 1; }
.site-nav a { text-decoration: none; padding-bottom: 3px; border-bottom: 1px solid transparent; }
.site-nav a:hover,
.site-nav a[aria-current="page"] { border-bottom-color: currentColor; }

.menu-toggle { display: none; }

main { padding: 32px var(--gutter) 120px; }

/* ---------- Home ---------- */

.home { min-height: 100vh; min-height: 100svh; position: relative; overflow: hidden; }
.home .site-header { position: absolute; inset: 0 0 auto 0; }
.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Keeps Emily (top of the wall) in frame as the window changes shape */
  object-position: 48% 40%;
  max-width: none;
}
.hero-text {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  top: 48%;
  text-align: center;
  color: #fff;
  text-shadow: 0 1px 24px rgba(0,0,0,0.25);
}
.hero-text h1, .hero-text p {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(42px, 4.7vw, 68px);
  line-height: 1.23;
}
.hero-text p + p { margin-top: 0; }

/* ---------- About ---------- */

.about {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr);
  gap: clamp(40px, 7vw, 110px);
  align-items: start;
  padding-top: 24px;
}
.about-photo img { width: 100%; border-radius: 22px; }
.photo-credit { margin-top: 10px; text-align: center; font-size: 15px; color: var(--muted); }
.about-text { padding-top: 56px; max-width: 620px; }

.downloads { max-width: 1110px; margin: 120px auto 0; text-align: center; }
.downloads h2 { margin-bottom: 28px; }
.download-grid { display: flex; gap: 12px; justify-content: center; align-items: flex-start; }
.download-grid figure { flex: var(--ratio) 1 0; }
.download-grid a:has(img) { display: block; }
.download-grid img { width: 100%; }
.download-grid figcaption { margin-top: 8px; font-size: 16px; }

/* ---------- Books (from spencerthielmann.com) ---------- */

.book {
  max-width: 1160px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  column-gap: clamp(40px, 6vw, 88px);
  align-items: start;
  padding-top: 24px;
}
.book + .book { margin-top: 120px; padding-top: 120px; border-top: 1px solid var(--rule); }

.cover-wrap { grid-column: 1; grid-row: 1; }
.book-text { grid-column: 2; grid-row: 1 / span 2; }

.cover {
  aspect-ratio: 2 / 3;
  background: var(--card);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 14px 30px -14px rgba(0,0,0,0.4);
  overflow: hidden;
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-credit { margin-top: 12px; color: var(--muted); font-size: 15px; text-align: center; }

/* Jocie and Stormi, under the cover */
.book-art {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  margin-top: 48px;
}
.book-art figure:first-child { width: 54%; }
.book-art figure:last-child { width: 40%; }
.book-art img { width: 100%; }
.book-art figcaption { margin-top: 6px; text-align: center; font-size: 15px; color: var(--muted); }

.book h1 { font-size: clamp(40px, 4vw, 60px); }
.byline { margin-top: 10px; font-family: var(--display); font-size: 26px; font-style: italic; font-weight: 500; }
.book-meta { margin-top: 14px; margin-bottom: 32px; color: var(--muted); font-size: 17px; line-height: 1.6; }
.hook { font-weight: 500; }

.buy {
  margin-top: 40px;
  padding: 22px 24px 24px;
  border: 1px solid var(--ink);
}
.buy-label { font-family: var(--display); font-size: 28px; font-weight: 500; line-height: 1.2; margin-bottom: 16px; }
.buy-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.buy-links a {
  display: block;
  padding: 9px 12px;
  text-align: center;
  font-size: 18px;
  line-height: 1.5;
  text-decoration: none;
  border: 1px solid var(--rule);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.buy-links a:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* ---------- Essays ---------- */

.essays { max-width: 880px; margin: 0 auto; padding-top: 24px; }
.essays > h1 { text-align: center; margin-bottom: 64px; }
.essay + .essay { margin-top: 56px; }
.essay h2 { font-size: clamp(28px, 2.6vw, 37px); line-height: 1.33; }
.essay h2 .pub { font-weight: 700; }
.essay blockquote { margin-top: 18px; font-size: 22px; line-height: 1.8; }
.essay .date { margin-top: 4px; font-size: 18px; color: var(--muted); }
.hire { margin-top: 96px; text-align: center; font-family: var(--display); font-size: clamp(28px, 2.6vw, 37px); font-style: italic; font-weight: 500; }

/* ---------- Films ---------- */

.films { max-width: 1120px; margin: 0 auto; padding-top: 24px; }
.film + .film { margin-top: 120px; }
.film { scroll-margin-top: 24px; }
.film-video { position: relative; aspect-ratio: 16 / 9; background: #111; }
.film-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.film-info { max-width: 760px; margin: 36px auto 0; }
.film-info h2 { text-align: center; }
.film-meta { text-align: center; color: var(--muted); font-size: 18px; margin: 4px 0 20px; }
.film-stills {
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.film-stills img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }

/* ---------- Contact ---------- */

.contact {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px clamp(40px, 8vw, 120px);
  padding-top: 24px;
}
.contact-intro { padding-top: 48px; }
.contact-intro h1 { font-size: clamp(30px, 2.6vw, 37px); margin-bottom: 48px; }
.rep-label { font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; font-size: 18px; }
.rep p + p { margin-top: 0; }
.about-rep { margin-top: 48px; }

.form { display: grid; gap: 22px; align-content: start; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form label { display: block; font-size: 17px; line-height: 1.4; margin-bottom: 6px; }
.form label small { color: var(--muted); font-size: 14px; margin-left: 4px; }
.form input, .form textarea {
  width: 100%;
  font: inherit;
  font-size: 18px;
  line-height: 1.4;
  padding: 11px 12px;
  border: 1px solid #a8a8a8;
  border-radius: 0;
  background: #fafafa;
  color: var(--ink);
}
.form input:focus, .form textarea:focus { outline: 2px solid var(--ink); outline-offset: -1px; background: #fff; }
.form textarea { min-height: 120px; resize: vertical; }
.form button {
  justify-self: start;
  font: inherit;
  font-size: 17px;
  line-height: 1;
  padding: 14px 22px;
  border: 0;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
}
.form button:hover { background: #333; }
.form button:disabled { opacity: 0.6; cursor: default; }
.form-status { font-size: 17px; min-height: 1.5em; }
.hp { display: none; }

.substack-text { align-self: center; font-family: var(--display); font-size: clamp(28px, 2.6vw, 37px); font-weight: 500; line-height: 1.3; }
.substack-embed { width: 100%; max-width: 480px; height: 320px; border: 1px solid #eee; background: #fff; }

/* ---------- 404 ---------- */

.notfound { max-width: 640px; margin: 0 auto; padding-top: 80px; text-align: center; }
.notfound p { margin-top: 20px; }

/* ---------- Tablets ---------- */

@media (max-width: 900px) {
  .about, .book, .contact { gap: 40px; }
  .book { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr); }
}

/* ---------- Phones: menu button + single column ---------- */

@media (max-width: 760px) {
  body { font-size: 18px; line-height: 1.7; }
  .site-header { padding: 28px var(--gutter); }

  .menu-toggle {
    display: block;
    position: relative;
    z-index: 30;
    width: 44px;
    height: 32px;
    margin-right: -6px;
    background: none;
    border: 0;
    cursor: pointer;
    color: inherit;
  }
  .menu-toggle span,
  .menu-toggle::before {
    content: "";
    position: absolute;
    left: 6px;
    right: 6px;
    height: 1.5px;
    background: currentColor;
    transition: transform 0.2s;
  }
  .menu-toggle::before { top: 11px; }
  .menu-toggle span { top: 19px; }
  .menu-open .menu-toggle::before { transform: translateY(4px) rotate(45deg); }
  .menu-open .menu-toggle span { transform: translateY(-4px) rotate(-45deg); }

  .site-nav {
    position: fixed;
    inset: 0;
    z-index: 20;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--display);
    font-size: 34px;
    font-weight: 500;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s, visibility 0.2s;
  }
  .menu-open .site-nav { visibility: visible; opacity: 1; }
  .menu-open .name { position: relative; z-index: 30; }
  .menu-open { overflow: hidden; }

  main { padding-top: 8px; padding-bottom: 88px; }

  .hero-text { top: 46%; }

  .about { grid-template-columns: 1fr; gap: 0; padding-top: 0; }
  .about-photo { max-width: 420px; }
  .about-text { padding-top: 40px; }
  .downloads { margin-top: 80px; }
  .download-grid { flex-direction: column; align-items: stretch; gap: 24px; }

  .book { grid-template-columns: 1fr; grid-template-rows: none; gap: 36px; padding-top: 0; }
  .cover-wrap, .book-text, .book-art { grid-column: 1; grid-row: auto; }
  .cover-wrap { max-width: 320px; }
  .book-art { margin-top: 0; max-width: 360px; margin-inline: auto; }
  .buy { padding: 18px; }
  .buy-links { grid-template-columns: 1fr; }

  .essays > h1 { margin-bottom: 48px; }
  .essay blockquote { font-size: 19px; }

  .film + .film { margin-top: 88px; }
  .film-video { margin-inline: calc(var(--gutter) * -1); }
  .film-stills { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .contact { grid-template-columns: 1fr; gap: 48px; padding-top: 0; }
  .contact-intro { padding-top: 0; }
  .contact-intro h1 { margin-bottom: 32px; }
  .form .row { grid-template-columns: 1fr; }
  .substack-text { margin-top: 24px; }
}
