/* ============================================================
   ericstrains.com — design system
   A warm, hobbyist / vintage-train aesthetic on a modern shell.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  /* Color — warm parchment, mahogany, brass */
  --c-cream:        #f5ecd9;   /* page background, parchment */
  --c-cream-soft:   #ede1c6;   /* secondary surface */
  --c-paper:        #fbf6e9;   /* card surface */
  --c-ink:          #2a1810;   /* primary text */
  --c-ink-soft:     #5a3d2a;   /* secondary text */
  --c-mahogany:     #3b2317;   /* deep accent */
  --c-mahogany-dk:  #261208;
  --c-brass:        #b8862f;   /* metallic accent */
  --c-brass-lt:     #d4a64a;
  --c-signal:       #8b2e2a;   /* signal red */
  --c-rail-green:   #2e4a3a;   /* depot green */
  --c-rule:         #c8b48a;   /* hairline rules */

  /* Type */
  --f-display: "Cinzel", "Playfair Display", Georgia, serif;
  --f-heading: "Playfair Display", Georgia, serif;
  --f-body:    "Lora", Georgia, "Times New Roman", serif;
  --f-mono:    ui-monospace, "SF Mono", Menlo, monospace;

  /* Layout */
  --w-max: 1180px;
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;
  --s-1: 0.5rem;
  --s-2: 1rem;
  --s-3: 1.5rem;
  --s-4: 2rem;
  --s-5: 3rem;
  --s-6: 4.5rem;

  /* Shadows */
  --shadow-card: 0 1px 0 rgba(40, 24, 16, .04),
                 0 8px 24px -12px rgba(40, 24, 16, .25);
  --shadow-lift: 0 2px 0 rgba(40, 24, 16, .05),
                 0 18px 36px -16px rgba(40, 24, 16, .35);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--c-ink);
  background: var(--c-cream);
  /* subtle paper texture using a layered radial+linear gradient */
  background-image:
    radial-gradient(rgba(184, 134, 47, 0.05) 1px, transparent 1px),
    radial-gradient(rgba(59, 35, 23, 0.03) 1px, transparent 1px);
  background-size: 24px 24px, 17px 17px;
  background-position: 0 0, 12px 12px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; display: block; }

a {
  color: var(--c-signal);
  text-decoration-color: rgba(139, 46, 42, .35);
  text-underline-offset: 3px;
  transition: color .15s ease;
}
a:hover { color: var(--c-mahogany); }

h1, h2, h3, h4 {
  font-family: var(--f-heading);
  color: var(--c-mahogany);
  line-height: 1.2;
  margin: 0 0 var(--s-2);
  font-weight: 700;
}
h1 { font-size: clamp(2rem, 4vw + 1rem, 3.4rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.5rem, 2vw + 1rem, 2.2rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 var(--s-2); }

.container {
  width: 100%;
  max-width: var(--w-max);
  margin: 0 auto;
  padding: 0 var(--s-3);
}

main { flex: 1; padding: var(--s-5) 0 var(--s-6); }

/* ---------- Site header (nameplate) ---------- */
.site-header {
  background: linear-gradient(180deg, var(--c-mahogany) 0%, var(--c-mahogany-dk) 100%);
  color: var(--c-cream);
  border-bottom: 4px solid var(--c-brass);
  position: relative;
}
.site-header::after {
  /* subtle brass rivet line under the nav */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 4px;
  background: var(--c-brass);
  box-shadow: 0 1px 0 var(--c-brass-lt) inset, 0 -1px 0 rgba(0,0,0,.25) inset;
}

.nameplate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-3);
  max-width: var(--w-max);
  margin: 0 auto;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  text-decoration: none;
  color: var(--c-cream);
}
/* Legacy circular mark, kept in case we want to use it again. */
.brand-mark {
  width: 46px;
  height: 46px;
  border: 2px solid var(--c-brass);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--c-brass-lt);
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,.08), transparent 60%),
    var(--c-mahogany-dk);
  letter-spacing: 0.04em;
}

/* Cream "emblem plate" that holds the railroad herald logo against the
   dark mahogany header. Brass trim + subtle inner shadow gives it a
   depot-sign feel and ensures the logo's dark text stays readable. */
.brand-emblem {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  background: var(--c-cream);
  border: 1px solid var(--c-brass);
  border-radius: var(--r-md);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -1px 0 rgba(40, 24, 16, 0.08),
    0 1px 0 rgba(0, 0, 0, 0.15);
  line-height: 0; /* prevent extra vertical space below the img */
}
.brand-emblem img {
  display: block;
  height: 52px;
  width: auto;
  max-width: 160px;
}
@media (max-width: 520px) {
  .brand-emblem img { height: 42px; max-width: 130px; }
}
.brand-title {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.brand-name {
  font-family: var(--f-display);
  font-size: 1.55rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-cream);
}
.brand-tag {
  font-family: var(--f-body);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--c-brass-lt);
  margin-top: 4px;
  letter-spacing: 0.04em;
}

.main-nav {
  display: flex;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.main-nav a {
  font-family: var(--f-display);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.82rem;
  color: var(--c-cream);
  text-decoration: none;
  padding: 0.4rem 0.2rem;
  border-bottom: 2px solid transparent;
  transition: border-color .15s ease, color .15s ease;
}
.main-nav a:hover,
.main-nav a.is-active {
  color: var(--c-brass-lt);
  border-bottom-color: var(--c-brass);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  background:
    linear-gradient(180deg, rgba(245,236,217,0) 0%, var(--c-cream) 100%),
    linear-gradient(180deg, var(--c-cream-soft) 0%, var(--c-cream) 100%);
  border-bottom: 1px solid var(--c-rule);
  padding: var(--s-6) 0 var(--s-5);
}
.hero::before {
  /* train-track motif */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 22px;
  background:
    linear-gradient(90deg, var(--c-mahogany) 0 12px, transparent 12px 28px) repeat-x 0 50% / 28px 6px,
    linear-gradient(180deg, transparent 0 8px, var(--c-brass) 8px 10px, transparent 10px 12px, var(--c-brass) 12px 14px, transparent 14px) repeat-x 0 0 / 100% 22px;
  opacity: 0.55;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--s-5);
  align-items: center;
}
.hero-eyebrow {
  font-family: var(--f-display);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.78rem;
  color: var(--c-brass);
  margin-bottom: var(--s-2);
}
.hero h1 { margin-bottom: var(--s-3); }
.hero-lede {
  font-size: 1.15rem;
  color: var(--c-ink-soft);
  max-width: 52ch;
}
.hero-cta {
  display: flex;
  gap: var(--s-2);
  margin-top: var(--s-3);
  flex-wrap: wrap;
}
.hero-art {
  background: var(--c-paper);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-lg);
  padding: var(--s-3);
  box-shadow: var(--shadow-card);
  position: relative;
}
.hero-art-label {
  font-family: var(--f-display);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--c-brass);
  margin-bottom: var(--s-1);
}
.hero-art-quote {
  font-family: var(--f-heading);
  font-style: italic;
  font-size: 1.4rem;
  line-height: 1.3;
  color: var(--c-mahogany);
}
.hero-art-attr {
  margin-top: var(--s-2);
  font-size: 0.9rem;
  color: var(--c-ink-soft);
}

/* "Latest from the channel" — embed shown in the hero. Same parchment frame
   as .hero-art so the layout doesn't shift when the feed comes through. */
.hero-video {
  background: var(--c-paper);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-lg);
  padding: var(--s-2);
  box-shadow: var(--shadow-card);
}
.hero-video-label {
  font-family: var(--f-display);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--c-brass);
  margin: 0 0 var(--s-1);
  padding: 0 var(--s-1);
}
.hero-video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--c-mahogany-dk);
  border-radius: calc(var(--r-lg) - 4px);
  overflow: hidden;
}
.hero-video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.hero-video-title {
  font-family: var(--f-heading);
  font-size: 1.05rem;
  color: var(--c-mahogany);
  margin: var(--s-2) var(--s-1) var(--s-1);
  line-height: 1.3;
}

@media (max-width: 800px) {
  .hero-inner { grid-template-columns: 1fr; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  font-family: var(--f-display);
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(180deg, var(--c-brass-lt) 0%, var(--c-brass) 100%);
  color: var(--c-mahogany-dk);
  border-color: var(--c-brass);
  box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, var(--shadow-card);
}
.btn-primary:hover { box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, var(--shadow-lift); color: var(--c-mahogany-dk); }

.btn-ghost {
  background: transparent;
  color: var(--c-mahogany);
  border-color: var(--c-mahogany);
}
.btn-ghost:hover { background: var(--c-mahogany); color: var(--c-cream); }

/* ---------- Section heading ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  margin: var(--s-5) 0 var(--s-3);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--c-rule);
}
.section-head .eyebrow {
  font-family: var(--f-display);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--c-brass);
  margin-bottom: 0.3rem;
}
.section-head h2 { margin: 0; }
.section-head .meta { color: var(--c-ink-soft); font-size: 0.9rem; }

/* ---------- Card grids ---------- */
.grid {
  display: grid;
  gap: var(--s-3);
}
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 900px) {
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
}

.card {
  background: var(--c-paper);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }

.card-media {
  position: relative;
  background: var(--c-mahogany-dk);
  aspect-ratio: 16 / 9;
}
.card-media img,
.card-media iframe {
  width: 100%; height: 100%;
  border: 0;
  object-fit: cover;
}
.card-media.square { aspect-ratio: 4 / 3; }

.card-body {
  padding: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}
.card-title {
  font-family: var(--f-heading);
  font-size: 1.15rem;
  color: var(--c-mahogany);
  margin: 0;
  line-height: 1.3;
}
.card-meta {
  font-family: var(--f-display);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--c-brass);
}
.card-text {
  color: var(--c-ink-soft);
  font-size: 0.96rem;
  margin: 0;
}
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: var(--s-1);
}
.tag {
  font-family: var(--f-display);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-rail-green);
  background: rgba(46, 74, 58, 0.08);
  border: 1px solid rgba(46, 74, 58, 0.25);
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
}

/* ---------- Featured / mixed layouts ---------- */
.featured {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: var(--s-4);
  align-items: stretch;
  margin: var(--s-3) 0 var(--s-4);
}
.featured .card-media { aspect-ratio: 16 / 9; }
@media (max-width: 800px) { .featured { grid-template-columns: 1fr; } }

/* ---------- Page intro ---------- */
.page-intro {
  max-width: 70ch;
  margin: 0 auto var(--s-4);
  text-align: center;
}
.page-intro .eyebrow {
  font-family: var(--f-display);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--c-brass);
}
.page-intro h1 { margin: 0.5rem 0 var(--s-2); }
.page-intro p {
  color: var(--c-ink-soft);
  font-size: 1.08rem;
}

/* ---------- Contact form ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: var(--s-4);
  align-items: start;
}
@media (max-width: 800px) { .contact-grid { grid-template-columns: 1fr; } }

.contact-form {
  background: var(--c-paper);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  box-shadow: var(--shadow-card);
}
.contact-form .field { margin-bottom: var(--s-3); }
.contact-form label {
  display: block;
  font-family: var(--f-display);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c-mahogany);
  margin-bottom: 0.4rem;
}
.contact-form input,
.contact-form textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--c-ink);
  background: var(--c-cream);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-sm);
  padding: 0.7rem 0.85rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.contact-form textarea { min-height: 160px; resize: vertical; }
.contact-form input:focus,
.contact-form textarea:focus {
  outline: 0;
  border-color: var(--c-brass);
  box-shadow: 0 0 0 3px rgba(184, 134, 47, 0.25);
}

.contact-aside {
  background: var(--c-cream-soft);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-lg);
  padding: var(--s-4);
}
.contact-aside h3 { color: var(--c-mahogany); margin-top: 0; }
.contact-aside ul { list-style: none; padding: 0; margin: 0; }
.contact-aside li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0;
  border-bottom: 1px dashed var(--c-rule);
}
.contact-aside li:last-child { border-bottom: 0; }
.contact-aside a { font-family: var(--f-body); }

/* Form feedback */
.flash {
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  margin-bottom: var(--s-3);
  border: 1px solid;
}
.flash.success {
  background: rgba(46, 74, 58, 0.08);
  border-color: var(--c-rail-green);
  color: var(--c-rail-green);
}
.flash.error {
  background: rgba(139, 46, 42, 0.08);
  border-color: var(--c-signal);
  color: var(--c-signal);
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: auto;
  background: var(--c-mahogany);
  color: var(--c-cream);
  border-top: 4px solid var(--c-brass);
  padding: var(--s-4) 0 var(--s-3);
  font-size: 0.92rem;
}
.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.site-footer .social {
  display: flex;
  gap: var(--s-2);
}
.site-footer .social a {
  color: var(--c-cream);
  text-decoration: none;
  font-family: var(--f-display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.78rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--c-brass);
  border-radius: var(--r-sm);
  transition: background .15s ease, color .15s ease;
}
.site-footer .social a:hover {
  background: var(--c-brass);
  color: var(--c-mahogany-dk);
}
.site-footer .credit {
  color: var(--c-brass-lt);
  font-size: 0.82rem;
}

/* ---------- Utility ---------- */
.center { text-align: center; }
.muted { color: var(--c-ink-soft); }
.divider {
  height: 1px;
  background: var(--c-rule);
  margin: var(--s-4) 0;
  border: 0;
}
