/* ============================================================
   wegway.ca — "The Ledger" design system
   Steve Armstrong, visual art 1976–2024
   ============================================================ */

:root {
  /* Color — dark "charcoal ledger", matching the original wegway.com */
  --paper:      #111111;   /* charcoal ground */
  --paper-dim:  #1E1C19;   /* recessed surfaces (tabs, inputs, notes) */
  --ink:        #E7E4DC;   /* light ledger ink */
  --ink-soft:   #9B978D;   /* faded ink / secondary text */
  --rule:       #3A3630;   /* ledger rule lines */
  --blue:       #7EA6D9;   /* stamp blue — accent (lightened for dark) */
  --oxide:      #CF6F5C;   /* rubber-stamp red — sparse accent (lightened) */
  --paper-rgb:  17, 17, 17;

  /* Type — unified to a single family across the site, matching the CV page */
  --f-display: 'Source Serif 4', Georgia, serif;
  --f-body:    'Source Serif 4', Georgia, serif;
  --f-mono:    'Source Serif 4', Georgia, serif;

  --tab-w: 92px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; color-scheme: dark; }

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

a { color: inherit; }

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

::selection { background: var(--blue); color: var(--paper); }

/* Focus visibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}

/* ---------- Site header ---------- */

.site-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--rule);
}

.site-head .mark {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.02em;
  text-decoration: none;
  text-transform: uppercase;
  text-align: center;
}

.site-head .mark small {
  display: block;
  font-family: var(--f-mono);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  text-transform: none;
  margin-top: 2px;
}

nav.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  font-family: var(--f-mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

nav.site-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

nav.site-nav a:hover,
nav.site-nav a[aria-current="page"] {
  color: var(--ink);
  border-color: var(--oxide);
}

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

.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  align-items: stretch;
  border-bottom: 1px solid var(--rule);
  min-height: 62vh;
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; min-height: auto; }
}

.hero-text {
  padding: clamp(28px, 6vw, 72px) clamp(18px, 4vw, 56px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-eyebrow {
  font-family: var(--f-mono);
  font-size: 12.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--oxide);
  margin: 0 0 18px;
}

.hero-text h1 {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
}

.hero-text p.lede {
  font-size: 19px;
  max-width: 46ch;
  color: var(--ink-soft);
  margin: 0 0 28px;
}

.hero-cta {
  display: flex;
  gap: 18px;
  font-family: var(--f-mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero-cta a {
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
}

.hero-cta a.primary { color: var(--blue); border-color: var(--blue); }

.hero-figure {
  position: relative;
  overflow: hidden;
  background: var(--paper-dim);
  border-left: 1px solid var(--rule);
}

@media (max-width: 860px) {
  .hero-figure { border-left: none; border-top: 1px solid var(--rule); height: 46vh; }
}

.hero-figure img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.1s ease;
}

.hero-figure img.is-visible { opacity: 1; }

.hero-figure .cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: space-between;
  padding: 10px 16px;
  font-family: var(--f-mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  color: var(--ink);
  background: linear-gradient(to top, rgba(0,0,0,0.55), transparent);
}

/* ---------- Ledger layout: tabs + gallery ---------- */

.ledger {
  display: grid;
  grid-template-columns: var(--tab-w) 1fr;
}

@media (max-width: 720px) {
  .ledger { grid-template-columns: 1fr; }
}

.ledger-tabs {
  border-right: 1px solid var(--rule);
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  padding: 28px 0;
  background: var(--paper-dim);
}

@media (max-width: 720px) {
  .ledger-tabs {
    position: static;
    max-height: none;
    display: flex;
    overflow-x: auto;
    padding: 14px clamp(14px, 3vw, 24px);
    gap: 2px;
    border-right: none;
    border-bottom: 1px solid var(--rule);
  }
}

.tab-btn {
  display: block;
  width: 100%;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  font-family: var(--f-mono);
  color: var(--ink-soft);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-align: left;
  text-decoration: none;
  padding: 11px 8px 11px 14px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.tab-btn .n {
  display: block;
  font-size: 10px;
  opacity: 0.7;
  margin-top: 2px;
}

.tab-btn:hover { color: var(--ink); background: rgba(126,166,217,0.10); }

.tab-btn.active {
  color: var(--ink);
  border-left-color: var(--oxide);
  background: rgba(126,166,217,0.16);
  font-weight: 600;
}

@media (max-width: 720px) {
  .tab-btn { border-left: none; border-bottom: 3px solid transparent; padding: 8px 14px; }
  .tab-btn.active { border-bottom-color: var(--oxide); }
}

.ledger-main { padding: 28px clamp(14px, 3vw, 32px) 80px; }

.year-section {
  scroll-margin-top: 24px;
  margin-bottom: 44px;
}

.year-section:last-child { margin-bottom: 0; }

.ledger-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}

.ledger-heading h2 {
  font-family: var(--f-display);
  font-size: 28px;
  margin: 0;
  letter-spacing: 0.01em;
}

.ledger-heading .count {
  font-family: var(--f-mono);
  font-size: 12.5px;
  color: var(--ink-soft);
}

/* Masonry gallery via CSS columns so native aspect ratios survive */
.gallery {
  column-width: 150px;
  column-gap: 14px;
}

.plate {
  break-inside: avoid;
  margin-bottom: 14px;
  position: relative;
  cursor: zoom-in;
  background: var(--paper-dim);
  overflow: hidden;
}

.plate img {
  width: 100%;
  display: block;
  transition: transform 0.4s ease, filter 0.4s ease;
}

.plate:hover img { transform: scale(1.03); }

.plate .tag {
  position: absolute;
  left: 0;
  bottom: 0;
  right: 0;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink);
  padding: 7px 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.plate:hover .tag { opacity: 1; transform: translateY(0); }

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

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 9, 8, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 4vh 4vw;
}

.lightbox.open { display: flex; }

.lightbox img {
  max-width: 100%;
  max-height: 88vh;
  width: auto;
  margin: 0 auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.lightbox .lb-cap {
  position: absolute;
  bottom: 3vh;
  left: 0; right: 0;
  text-align: center;
  font-family: var(--f-mono);
  color: var(--ink);
  font-size: 12.5px;
  letter-spacing: 0.05em;
}

.lightbox .lb-close,
.lightbox .lb-nav {
  position: absolute;
  background: none;
  border: 1px solid rgba(231,228,220,0.4);
  color: var(--ink);
  font-family: var(--f-mono);
  font-size: 13px;
  cursor: pointer;
  padding: 8px 12px;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.lightbox .lb-close:hover,
.lightbox .lb-nav:hover { border-color: var(--ink); }

.lightbox .lb-close { top: 3vh; right: 3vw; }
.lightbox .lb-prev { top: 50%; left: 3vw; transform: translateY(-50%); }
.lightbox .lb-next { top: 50%; right: 3vw; transform: translateY(-50%); }

@media (max-width: 640px) {
  .lightbox .lb-prev, .lightbox .lb-next { padding: 8px 10px; }
}

/* ---------- Generic content pages (cv, contact, etc) ---------- */

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(36px, 6vw, 72px) clamp(18px, 4vw, 24px) 100px;
}

.page.page-wide { max-width: 880px; }

.page-eyebrow {
  font-family: var(--f-mono);
  font-size: 12.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--oxide);
  margin: 0 0 14px;
}

.page h1 {
  font-family: var(--f-display);
  font-size: 24px;
  margin: 0 0 28px;
  letter-spacing: 0.01em;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 20px;
}

.page h2 {
  font-family: var(--f-display);
  font-size: 20px;
  letter-spacing: 0.03em;
  color: var(--blue);
  margin: 40px 0 14px;
}

.page p { color: var(--ink); }

/* ---------- Writing post article ---------- */

.post-subtitle {
  font-family: var(--f-display);
  font-size: 19px;
  color: var(--ink-soft);
  margin: -18px 0 10px;
}

.post-date {
  font-family: var(--f-mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin: 0 0 24px;
}

.post-hero {
  margin: 0 0 32px;
  background: var(--paper-dim);
}

.post-hero img {
  width: 100%;
  height: auto;
  display: block;
}

.pdf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.pdf-actions .btn {
  display: inline-block;
  text-decoration: none;
}

.pdf-reader {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 28px;
}

.pdf-reader img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--rule);
  background: var(--paper-dim);
}

.post-body {
  font-size: 18px;
  line-height: 1.65;
}

.post-body p { margin: 0 0 22px; color: var(--ink); }

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4 {
  font-family: var(--f-display);
  color: var(--blue);
  line-height: 1.3;
  margin: 36px 0 14px;
}

.post-body h1 { font-size: 24px; border: none; padding: 0; }
.post-body h2 { font-size: 21px; }
.post-body h3 { font-size: 19px; }
.post-body h4 { font-size: 17px; }

.post-body a {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-color: var(--rule);
}

.post-body a:hover { text-decoration-color: var(--blue); }

.post-body img,
.post-body picture {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 22px;
}

.post-body figure { margin: 0 0 28px; }

.post-body figcaption {
  font-family: var(--f-mono);
  font-size: 12.5px;
  color: var(--ink-soft);
  text-align: center;
  margin-top: 8px;
}

.post-body blockquote {
  margin: 0 0 22px;
  padding: 4px 0 4px 18px;
  border-left: 3px solid var(--oxide);
  color: var(--ink-soft);
  font-style: italic;
}

.post-body ul,
.post-body ol { margin: 0 0 22px; padding-left: 24px; }
.post-body li { margin-bottom: 8px; }

.post-body hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 32px 0;
}

.post-body iframe {
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 22px;
}

.post-body pre {
  background: var(--paper-dim);
  padding: 14px;
  overflow-x: auto;
  font-family: var(--f-mono);
  font-size: 14px;
  margin: 0 0 22px;
}

.page .note {
  font-family: var(--f-mono);
  font-size: 12.5px;
  color: var(--ink-soft);
  background: var(--paper-dim);
  border-left: 3px solid var(--oxide);
  padding: 12px 14px;
  margin: 0 0 32px;
}

.entry-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}

.entry-row .yr {
  font-family: var(--f-mono);
  font-size: 13px;
  color: var(--ink-soft);
  padding-top: 2px;
}

.entry-row a.title {
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
}

.entry-row a.title:hover { text-decoration: underline; }

.entry-row .desc {
  display: block;
  color: var(--ink-soft);
  font-size: 15px;
  margin-top: 3px;
}

.entry-row .entry-body {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.entry-row .thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  overflow: hidden;
  display: block;
  background: var(--paper-dim);
}

.entry-row .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.entry-row .entry-text {
  flex: 1 1 auto;
  min-width: 0;
}

@media (max-width: 520px) {
  .entry-row { grid-template-columns: 1fr; gap: 4px; }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
  font-family: var(--f-mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input,
.field textarea {
  font-family: var(--f-body);
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  background: var(--paper-dim);
  color: var(--ink);
}

.field textarea { min-height: 140px; resize: vertical; }

.btn {
  font-family: var(--f-mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--blue);
  color: var(--paper);
  border: none;
  padding: 12px 22px;
  cursor: pointer;
}

.btn:hover { background: var(--ink); }

.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  font-family: var(--f-mono);
  font-size: 14px;
}
.contact-list a { text-decoration: none; color: var(--blue); }
.contact-list a:hover { text-decoration: underline; }

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

.site-foot-head {
  border-bottom: none;
  border-top: 1px solid var(--rule);
}

.site-foot-head + .site-foot {
  border-top: none;
}

footer.site-foot {
  border-top: 1px solid var(--rule);
  padding: 22px clamp(18px, 4vw, 48px);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  letter-spacing: 0.03em;
}
