/*
Theme Name: JEC Perry
Theme URI: https://jecperry.com
Author: ATLV Solutions
Description: Author site for Justice James E.C. Perry — the memoir Benchmarked, speaking engagements, and the store.
Version: 1.2.0
License: GNU General Public License v2 or later
Text Domain: jecperry
*/

:root {
  --ink: #16181d;
  --ink-soft: #4a4f59;
  --ink-faint: #7c828d;
  --paper: #fbf8f3;
  --paper-warm: #f3ede3;
  --rule: #ddd4c6;
  --brass: #9a7431;
  --brass-bright: #c19a4d;
  --navy: #1c2536;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, ui-serif, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --wrap: 1120px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }
a { color: var(--brass); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 720px; }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 0.5em; }
h1 { font-size: clamp(34px, 5vw, 52px); }
h2 { font-size: clamp(26px, 3.4vw, 36px); }
h3 { font-size: 21px; }

.eyebrow {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass);
  font-weight: 650;
  margin: 0 0 14px;
}

.lede { font-size: 20px; line-height: 1.6; color: var(--ink-soft); }

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

.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 40;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 78px;
}

.brand { font-family: var(--serif); font-size: 21px; font-weight: 600; color: var(--ink); text-decoration: none; line-height: 1.15; }
.brand small { display: block; font-family: var(--sans); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--brass); font-weight: 650; margin-top: 3px; }

.site-nav { margin-left: auto; }
.site-nav ul { display: flex; gap: 26px; list-style: none; margin: 0; padding: 0; }
.site-nav a { color: var(--ink-soft); text-decoration: none; font-size: 15px; }
.site-nav a:hover, .site-nav .current-menu-item > a { color: var(--ink); }

.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--rule); border-radius: 6px; padding: 9px 13px; font-size: 14px; cursor: pointer; color: var(--ink); }

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .site-nav { display: none; width: 100%; order: 3; }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; padding-bottom: 16px; }
  .site-nav li { border-top: 1px solid var(--rule); }
  .site-nav a { display: block; padding: 13px 0; }
  .site-header .wrap { flex-wrap: wrap; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  text-decoration: none;
  padding: 14px 26px;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid var(--navy);
}
.btn:hover { background: #253150; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn-ghost:hover { background: var(--paper-warm); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }

/* ---------- Hero ---------- */

.hero { padding: 76px 0 68px; border-bottom: 1px solid var(--rule); }
.hero .wrap { display: grid; grid-template-columns: 1fr 340px; gap: 60px; align-items: center; }
.hero-cover { border-radius: 3px; box-shadow: 0 26px 60px rgba(22, 24, 29, 0.28); display: block; }

@media (max-width: 860px) {
  .hero { padding: 44px 0 40px; }
  .hero .wrap { grid-template-columns: 1fr; gap: 34px; }
  .hero-cover { max-width: 260px; }
}

/* ---------- Sections ---------- */

.section { padding: 72px 0; }
.section + .section { border-top: 1px solid var(--rule); }
.section-warm { background: var(--paper-warm); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; gap: 32px; } .section { padding: 48px 0; } }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 860px) { .cards { grid-template-columns: 1fr; } }

.card { background: #fff; border: 1px solid var(--rule); border-radius: 6px; padding: 28px; }
.card h3 { margin-bottom: 8px; }
.card p { color: var(--ink-soft); margin: 0 0 14px; font-size: 15.5px; }
.card .price { font-family: var(--serif); font-size: 26px; color: var(--ink); display: block; margin-bottom: 14px; }

/* ---------- Timeline ---------- */

.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--rule); }
.timeline li { padding: 0 0 26px 26px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--brass); }
.timeline .year { font-family: var(--serif); font-size: 15px; color: var(--brass); font-weight: 600; display: block; }
.timeline .what { color: var(--ink); }

/* ---------- Content ---------- */

.page-head { padding: 62px 0 34px; border-bottom: 1px solid var(--rule); }
.entry { padding: 52px 0 72px; }
.entry p { margin: 0 0 1.15em; }
.entry h2 { margin-top: 1.6em; }
.entry ul, .entry ol { padding-left: 1.3em; }
.entry blockquote { margin: 1.8em 0; padding-left: 24px; border-left: 3px solid var(--brass); font-family: var(--serif); font-size: 21px; font-style: italic; color: var(--ink-soft); }

/* ---------- Forms ---------- */

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 12px 13px;
  font: inherit;
  font-size: 16px;
  background: #fff;
  color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--brass-bright); outline-offset: -1px; }
.field textarea { min-height: 140px; resize: vertical; }
.form-note { font-size: 13.5px; color: var(--ink-faint); margin-top: 14px; }
.notice { padding: 14px 16px; border-radius: 5px; margin-bottom: 22px; font-size: 15px; }
.notice-ok { background: #edf5ec; border: 1px solid #bcd8b8; color: #2c5127; }
.notice-err { background: #fbeeec; border: 1px solid #e2bdb6; color: #7d2f22; }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--rule); background: var(--navy); color: #cfd5e0; padding: 52px 0 34px; margin-top: 0; }
.site-footer a { color: #e2cb9b; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr; gap: 26px; } }
.site-footer h4 { font-family: var(--sans); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: #8e97a8; margin: 0 0 12px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 8px; font-size: 15px; }
.site-footer .brand-foot { font-family: var(--serif); font-size: 20px; color: #fff; margin: 0 0 10px; }
.colophon { border-top: 1px solid #2b364b; margin-top: 34px; padding-top: 20px; font-size: 13.5px; color: #8e97a8; }

/* ---------- The Journey in Photographs ---------- */

.journey { background: var(--paper-warm); scroll-margin-top: 90px; }
.journey-intro { max-width: 62ch; }

/* Without the script every photograph simply stacks, which still reads. */
.journey-list { list-style: none; margin: 0; padding: 0; }
.journey-slide { margin: 0 auto 20px; max-width: 520px; }

.journey-slider {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 34px auto 0;
  max-width: 720px;
}

.journey-stage { flex: 1 1 auto; min-width: 0; }

/* With the script: one photograph at a time, in a fixed frame so the
   surrounding page does not jump as portraits and landscapes alternate. */
.has-journey-js .journey-stage {
  position: relative;
  height: 400px;
  background: #efe7db;
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
}

.has-journey-js .journey-list { height: 100%; }

.has-journey-js .journey-slide {
  position: absolute;
  inset: 0;
  margin: 0;
  max-width: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease;
}

.has-journey-js .journey-slide.is-active { opacity: 1; visibility: visible; }

.journey-open {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  line-height: 0;
}

.journey-open img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.journey-open:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }

.journey-nav {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.journey-nav:hover { background: #fff; }
.journey-nav:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

.journey-meta {
  max-width: 720px;
  margin: 16px auto 0;
  display: flex;
  align-items: baseline;
  gap: 16px;
  min-height: 46px;
}

.journey-cap {
  flex: 1 1 auto;
  margin: 0;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.journey-cap.is-empty::before {
  content: 'Caption to come';
  color: var(--ink-faint);
  font-style: italic;
}

.journey-count {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.journey-toggle {
  background: none;
  border: 0;
  padding: 0;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass);
  cursor: pointer;
  white-space: nowrap;
}

.journey-toggle:hover { color: var(--ink); }

@media (max-width: 620px) {
  .has-journey-js .journey-stage { height: 300px; }
  .journey-nav { width: 36px; height: 36px; font-size: 20px; }
  .journey-meta { flex-wrap: wrap; gap: 8px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .has-journey-js .journey-slide { transition: none; }
}

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(12, 13, 16, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 20px 84px;
}

/* The class sets display:flex, which would otherwise beat the browser's
   [hidden] rule and leave an invisible overlay swallowing clicks. */
.lightbox[hidden] { display: none; }

.lightbox-figure {
  margin: 0;
  max-width: min(1100px, 92vw);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.lightbox-figure img {
  max-width: 100%;
  max-height: calc(100vh - 210px);
  object-fit: contain;
  background: #1a1b1f;
}

.lightbox-figure figcaption {
  color: #efe8dc;
  font-size: 15.5px;
  line-height: 1.5;
  text-align: center;
  max-width: 70ch;
  font-family: var(--serif);
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  background: none;
  border: 0;
  color: #e6ddcd;
  cursor: pointer;
  padding: 10px 16px;
  line-height: 1;
}

.lightbox-close { top: 14px; right: 18px; font-size: 38px; }
.lightbox-nav { top: 50%; transform: translateY(-50%); font-size: 46px; }
.lightbox-nav.prev { left: 6px; }
.lightbox-nav.next { right: 6px; }
.lightbox-close:hover, .lightbox-nav:hover { color: var(--brass-bright); }
.lightbox-close:focus-visible, .lightbox-nav:focus-visible { outline: 2px solid var(--brass); }

.lightbox-count {
  position: absolute;
  bottom: 22px;
  left: 0;
  right: 0;
  text-align: center;
  color: #9aa0ad;
  font-size: 12.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0;
}

@media (max-width: 620px) {
  .lightbox { padding: 56px 10px 74px; }
  .lightbox-nav { font-size: 34px; }
  .lightbox-figure figcaption { font-size: 14.5px; }
}
