/* treysonwelch.com email group: portfolio index, campaigns gallery, automation-flow template.
   Loads after /assets/site.css and only adds components the email pages share. */

.nav a[aria-current="page"] { color: var(--ink); background: var(--bg-2); }

/* ---------- Page head ---------- */
.ehead { padding: 44px 0 80px; }
.back {
  display: inline-flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 600; color: var(--ink-2);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; text-decoration-color: transparent;
  transition: color .2s, text-decoration-color .2s;
}
.back svg { width: 14px; height: 14px; transform: scaleX(-1); transition: transform .3s var(--ease); }
.back:hover { color: var(--ink); text-decoration-color: var(--cherry); }
.back:hover svg { transform: scaleX(-1) translateX(3px); }
.ehead h1 {
  margin-top: 32px; font-size: clamp(2.6rem, 5vw, 4.5rem); line-height: 1.02; font-weight: 600;
  letter-spacing: -0.038em; max-width: 16ch;
}
.ehead.flow h1 { font-size: clamp(2.2rem, 4.2vw, 3.6rem); line-height: 1.05; letter-spacing: -0.034em; max-width: 22ch; }
.ehead .sub { margin-top: 20px; font-size: 19px; line-height: 1.55; color: var(--ink-2); max-width: 56ch; }
.ehead .kind { margin-top: 22px !important; }

/* index head: copy left, spec label right */
.ehead-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 72px; align-items: center; margin-top: 8px; }
.ehead-grid .sticker { margin-top: 24px; }
.ehead .sticker { box-shadow: 0 1px 2px rgba(15,27,54,0.12), 0 26px 50px -26px rgba(15,27,54,0.45); }
.ehead .st-big .num { font-size: clamp(3.6rem, 6vw, 5rem); }

/* overall flow numbers, a spec strip */
.stats {
  margin: 44px 0 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--navy); border-bottom: 1px solid var(--line);
}
.stats > div { padding: 16px 20px 18px; }
.stats > div:first-child { padding-left: 0; }
.stats > div + div { border-left: 1px solid var(--line); }
.stats dt { font-size: 13.5px; color: var(--ink-3); }
.stats dd {
  margin: 4px 0 0; font-size: clamp(1.7rem, 2.8vw, 2.4rem); font-weight: 600; letter-spacing: -0.03em; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

/* ---------- Index: two doors ---------- */
.doors { padding: 104px 0 120px; }
.doors .pair { margin-top: 0; }
.work-item h2 { margin-top: 26px; font-size: 26px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.15; display: flex; align-items: center; gap: 10px; }
.work-item h2 svg { width: 18px; height: 18px; color: var(--ink-3); transition: transform .3s var(--ease), color .2s; }
.work-item:hover h2 { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; text-decoration-color: var(--cherry); }
.work-item:hover h2 svg { transform: translateX(4px); color: var(--cherry); }
.pair .shot.dark { background: var(--navy-2); box-shadow: 0 0 0 1px rgba(22,38,74,0.2); }
.pair .shot.dark img { width: 190%; max-width: none; margin-left: -38%; border-radius: 8px 8px 0 0; box-shadow: 0 0 0 1px rgba(245,241,232,0.12), 0 18px 36px -16px rgba(0,0,0,0.6); }

/* ---------- Automations list ---------- */
.flows { padding: 96px 0 128px; }
.flow-list { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid #D9D4C7; }
.flow-row {
  display: grid; grid-template-columns: 240px minmax(0, 1fr) auto; gap: 40px; align-items: center;
  padding: 32px 0; border-top: 1px solid #D9D4C7; text-decoration: none;
}
.flow-thumb {
  margin: 0; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; background: #1E1E1D;
  box-shadow: 0 0 0 1px rgba(22,38,74,0.12), 0 12px 26px -16px rgba(15,27,54,0.45);
}
.flow-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; transition: transform .7s var(--ease); }
.flow-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.flow-tags span {
  height: 26px; display: inline-flex; align-items: center; padding: 0 10px; border-radius: 7px; border: 1px solid #D3D0C6;
  font-size: 13px; font-weight: 500; color: var(--ink-2); background: #fff;
}
.flow-tags .auto-trigger { background: var(--navy); border-color: var(--navy); color: #fff; }
.flow-row h2 { margin-top: 14px; font-size: clamp(1.35rem, 2.2vw, 1.8rem); font-weight: 600; letter-spacing: -0.025em; line-height: 1.15; max-width: 30ch; }
.auto-stats { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 4px 0; font-family: var(--mono); font-size: 13.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.auto-stats span + span { margin-left: 14px; padding-left: 14px; border-left: 1px solid #CFCABD; }
.go {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; border: 1px solid #CFCABD; color: var(--ink);
  background: #fff; transition: background .25s, border-color .25s, color .25s;
}
.go svg { width: 16px; height: 16px; transition: transform .3s var(--ease); }
.flow-row:hover h2 { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; text-decoration-color: var(--cherry); }
.flow-row:hover .go { background: var(--navy); border-color: var(--navy); color: #fff; }
.flow-row:hover .go svg { transform: translateX(2px); }
.flow-row:hover .flow-thumb img { transform: translateY(-4px); }

/* ---------- Flow diagram band ---------- */
.flowsec { padding: 104px 0 112px; }
.flowsec-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 48px; align-items: end; margin-bottom: 40px; }
.flowsec h2 { font-size: clamp(2rem, 3.6vw, 3rem); line-height: 1.05; letter-spacing: -0.035em; font-weight: 600; }
.flowsec .note { margin-top: 14px; font-size: 17.5px; color: var(--on-navy-2); max-width: 52ch; }
.flowsec .kind span { background: transparent; color: var(--on-navy); border-color: var(--on-navy-line); }
.btn-line {
  justify-self: start; display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 18px 0 20px; border-radius: 10px;
  font-weight: 600; font-size: 15.5px; text-decoration: none; white-space: nowrap;
  color: var(--on-navy); border: 1px solid rgba(245,242,234,0.38); transition: border-color .2s, background .2s;
}
.btn-line svg { width: 16px; height: 16px; transition: transform .3s var(--ease); }
.btn-line:hover { border-color: var(--on-navy); background: rgba(245,242,234,0.06); }
.btn-line:hover svg { transform: translateX(3px); }
.diagram {
  margin: 0; border-radius: var(--r); overflow-x: auto; background: #1E1E1D;
  box-shadow: 0 0 0 1px var(--on-navy-line), 0 34px 70px -34px rgba(0,0,0,0.7);
  scrollbar-color: rgba(245,242,234,0.3) transparent;
}
.diagram img { width: 100%; min-width: 960px; }

/* ---------- Email records: campaigns and flow emails ---------- */
.emails { padding: 112px 0 128px; background: var(--paper); }
.emails.top { padding-top: 64px; }
.emails-head { margin-bottom: 64px; display: flex; justify-content: space-between; align-items: end; gap: 24px 40px; flex-wrap: wrap; }
.emails-head h2 { font-size: clamp(2rem, 3.6vw, 3rem); line-height: 1.05; letter-spacing: -0.035em; font-weight: 600; }
.emails-head .kind { margin-top: 0 !important; }
.eitem {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 560px); gap: 32px 72px; align-items: start;
  padding: 64px 0; border-top: 1px solid #D9D4C7;
}
.eitem:first-child { border-top: 0; padding-top: 0; }
.emeta { position: sticky; top: 104px; }
.erow { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.rank {
  display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: 7px;
  font-family: var(--mono); font-size: 13px; background: var(--navy); color: #fff; font-variant-numeric: tabular-nums;
}
.date { font-family: var(--mono); font-size: 13px; color: var(--ink-3); }
.ename { margin-top: 20px; font-size: clamp(1.5rem, 2.4vw, 2rem); font-weight: 600; letter-spacing: -0.025em; line-height: 1.14; max-width: 24ch; }
.subject, .preheader { margin-top: 12px; font-size: 16px; line-height: 1.55; color: var(--ink-2); max-width: 48ch; }
.subject + .preheader { margin-top: 6px; }
.subject strong, .preheader strong { color: var(--ink); font-weight: 600; }
.metrics {
  margin: 28px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; max-width: 440px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
}
.metrics.m8 { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 560px; }
.metrics > div { background: #fff; padding: 12px 14px 14px; min-width: 0; transition: background .35s var(--ease); }
.metrics dt { font-size: 12.5px; line-height: 1.3; color: var(--ink-3); }
.metrics dd { margin: 3px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metrics.m8 dd { font-size: 18px; }
.metrics .highlight { background: var(--navy); }
.metrics .highlight dt { color: var(--on-navy-2); }
.metrics .highlight dd { color: #fff; }

/* tall framed email preview */
.mail {
  margin: 0; background: #fff; border-radius: var(--r); padding: 14px;
  box-shadow: 0 0 0 1px rgba(22,38,74,0.08), 0 1px 2px rgba(15,27,54,0.06), 0 28px 56px -30px rgba(15,27,54,0.38);
}
.mail-view { position: relative; max-height: 760px; overflow: auto; border-radius: 6px; box-shadow: 0 0 0 1px var(--line-2); background: #fff; }
.js .mail-view { overflow: hidden; }
.mail-view img { width: 100%; cursor: zoom-in; }
.js .mail.tall .mail-view::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 140px; pointer-events: none;
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0.92) 70%, #fff);
}
.mail-foot { display: none; }
.js .mail-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 4px 2px; }
.mail-open {
  appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-size: 14px; font-weight: 600;
  height: 36px; padding: 0 12px 0 14px; border-radius: 8px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  transition: background .2s, border-color .2s;
}
.mail-open svg { width: 14px; height: 14px; }
.mail-open:hover { background: var(--wash); border-color: #C9CCD4; }
.mail-len { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); }

/* sorter for the campaigns gallery (reuses .tabs and .tab from site.css) */
.sortbar { position: sticky; top: 68px; z-index: 30; background: rgba(245,242,234,0.94); border-bottom: 1px solid #D9D4C7; }
@supports (backdrop-filter: blur(8px)) { .sortbar { backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); } }
.sortbar .wrap { height: 64px; display: flex; align-items: center; gap: 16px; }
.sortbar .tabs { background: #EAE5D8; }
.sortbar .tab { font-size: 14px; padding: 7px 14px; color: var(--ink-2); }
.sortbar .tab:hover { color: var(--ink); }
.sortbar .tab:disabled { opacity: 0.5; cursor: not-allowed; }
.sortbar .tab:disabled:hover { color: var(--ink-3); }
.sortbar + .emails { padding-top: 72px; }
.gallery-foot { margin-top: 56px; padding-top: 24px; border-top: 1px solid #D9D4C7; font-family: var(--mono); font-size: 13.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sortbar ~ .emails .emeta { top: 156px; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 100; display: none; overflow: auto; padding: 64px 20px; background: rgba(15,27,54,0.86); overscroll-behavior: contain; }
.lightbox.active { display: block; }
.lightbox img { width: 100%; max-width: 700px; margin: 0 auto; border-radius: 8px; box-shadow: 0 30px 80px -20px rgba(0,0,0,0.7); cursor: zoom-out; }
.lb-close {
  position: fixed; top: 14px; right: 14px; width: 44px; height: 44px; border-radius: 10px; border: 0; background: #fff; color: var(--ink);
  display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 20px -6px rgba(0,0,0,0.5);
}
.lb-close svg { width: 16px; height: 16px; }
body.lb-open { overflow: hidden; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .eitem { grid-template-columns: minmax(0, 1fr) minmax(0, 460px); gap: 32px 40px; }
  .metrics.m8 { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 440px; }
  .metrics.m8 dd { font-size: 20px; }
}
@media (max-width: 900px) {
  .ehead-grid { grid-template-columns: minmax(0, 1fr); gap: 48px; }
  .ehead .sticker { max-width: 520px; }
  .flow-row { grid-template-columns: 180px minmax(0, 1fr) auto; gap: 24px; }
  .eitem { grid-template-columns: minmax(0, 1fr); }
  .emeta { position: static; }
  .mail { max-width: 600px; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats > div:nth-child(4) { border-left: 0; padding-left: 0; }
  .stats > div:nth-child(n+4) { border-top: 1px solid var(--line); }
}
@media (max-width: 720px) {
  .ehead { padding: 32px 0 64px; }
  .ehead h1 { font-size: clamp(2.45rem, 11.4vw, 3.4rem); letter-spacing: -0.04em; }
  .ehead.flow h1 { font-size: clamp(2rem, 8.6vw, 2.6rem); }
  .ehead .sub { font-size: 17.5px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats > div { padding: 14px 14px 16px; }
  .stats > div:nth-child(odd) { border-left: 0; padding-left: 0; }
  .stats > div:nth-child(4) { border-left: 1px solid var(--line); padding-left: 14px; }
  .stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .flows { padding: 64px 0 88px; }
  .flow-row { grid-template-columns: minmax(0, 1fr) auto; gap: 18px 16px; padding: 28px 0; align-items: start; }
  .flow-thumb { grid-column: 1 / -1; }
  .go { margin-top: 2px; }
  .auto-stats span + span { margin-left: 10px; padding-left: 10px; }
  .flowsec { padding: 72px 0 80px; }
  .flowsec-head { grid-template-columns: minmax(0, 1fr); margin-bottom: 28px; }
  .diagram { margin: 0 -8px; }
  .diagram img { min-width: 760px; }
  .emails { padding: 80px 0 88px; }
  .emails-head { margin-bottom: 44px; }
  .eitem { padding: 48px 0; gap: 28px; }
  .mail { padding: 10px; margin: 0 -6px; }
  .mail-view { max-height: 560px; }
  .sortbar { top: 62px; }
  .sortbar .wrap { height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; gap: 6px; }
  .sortbar .tabs { width: 100%; }
  .sortbar .tab { flex: 1; padding: 7px 4px; font-size: 13.5px; }
  .sortbar + .emails { padding-top: 48px; }
  .lightbox { padding: 64px 10px 24px; }
}
