/* =========================================================
   Rory O'Donnell — Portfolio
   Design system
   ========================================================= */

/* ---------- Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s ease, color 0.3s ease;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ---------- Tokens ---------- */
:root {
  /* Font stacks — Adobe Fonts (Typekit) primary, with fallbacks */
  --font-sans: "franklin-gothic-urw", "Franklin Gothic Medium", "Helvetica Neue", Arial, sans-serif;
  --font-serif: "freight-text-pro", "Freight Text Pro", Georgia, "Times New Roman", serif;
  --font-mono: "Roboto Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Spacing */
  --space-gutter: 44px;
  --maxw: 1320px;

  /* Radius */
  --r-sm: 4px;
  --r-pill: 999px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
}

/* Dark (default) */
[data-theme="dark"] {
  --bg: #0e0e0c;
  --fg: #e8e4d8;
  --fg-muted: rgba(232, 228, 216, 0.55);
  --fg-sub:   rgba(232, 228, 216, 1);
  --fg-faint: rgba(232, 228, 216, 0.28);
  --rule: rgba(232, 228, 216, 0.25);
  --invert-bg: #e8e4d8;
  --invert-fg: #0e0e0c;
}

/* Light */
[data-theme="light"] {
  --bg: #f2efe8;
  --fg: #1a1a18;
  --fg-muted: rgba(26, 26, 24, 0.6);
  --fg-sub:   rgba(26, 26, 24, 1);
  --fg-faint: rgba(26, 26, 24, 0.3);
  --rule: rgba(26, 26, 24, 0.25);
  --invert-bg: #1a1a18;
  --invert-fg: #f2efe8;
}

/* ---------- Layout ---------- */
.site {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px var(--space-gutter) 80px;
}

/* ---------- Top bar ---------- */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  position: sticky;
  top: 0;
  z-index: 100;
  padding-top: 40px;
  margin-top: -40px;
  mix-blend-mode: exclusion;
}

.top-rule {
  margin-bottom: 96px;
}

.mark,
.top-right {
  position: relative;
}

.mark {
  display: flex;
  align-items: center;
}

.mark-logo {
  height: 28px;
  width: auto;
  display: block;
}

/* Always show white logo — exclusion handles contrast on both themes */
.mark-logo--light { display: none; }

.top-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* All nav elements inside .top must be white for exclusion to work:
   white + dark bg  → near-white (readable on dark)
   white + light bg → near-black (readable on light)
   white + any image → inverts for maximum contrast */
.top .pill {
  border-color: white;
  color: white;
}
.top .pill:hover {
  background: white;
  color: black;
}
.top .pill:hover span { color: black; }

.top .toggle {
  border-color: white;
}
.top .toggle-knob {
  background: white;
}
.top .toggle-icon {
  color: white;
}

.nav {
  display: flex;
  gap: 6px;
}

/* ---------- Pill (shared component) ---------- */
.pill {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--fg);
  color: var(--fg);
  background: transparent;
  display: inline-flex;
  align-items: center;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
  white-space: nowrap;
}

.pill:hover { background: var(--fg); color: var(--bg); }
.pill:hover span { color: var(--bg); }
.pill span { transition: color 0.18s var(--ease); }

/* ---------- iOS-style theme toggle ---------- */
.toggle {
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: var(--r-pill);
  border: 1px solid var(--fg);
  background: transparent;
  padding: 0;
  margin-left: 6px;
  transition: background 0.22s var(--ease), border-color 0.22s var(--ease);
}

.toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--fg);
  transition: transform 0.24s var(--ease), background 0.22s var(--ease);
}

[data-theme="light"] .toggle-knob { transform: translateX(20px); }

.toggle-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg);
  opacity: 0.45;
  pointer-events: none;
}

.toggle-icon--moon { right: 6px; }
.toggle-icon--sun  { left: 6px; }

[data-theme="dark"]  .toggle-icon--sun  { display: none; }
[data-theme="light"] .toggle-icon--moon { display: none; }

/* ---------- Intro ---------- */
.intro {
  max-width: 820px;
  margin-bottom: 140px;
}

.intro-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0 0 24px;
  font-weight: 500;
}

.intro-line {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: clamp(52px, 7vw, 80px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0;
}

.intro-line em {
  font-family: var(--font-serif);
  font-style: normal;
  font-weight: 500;
}

.mob-br { display: none; }

.intro-sub {
  font-family: var(--font-serif);
  font-style: normal;
  font-weight: 400;
  font-size: 22px;
  line-height: 1.5;
  color: var(--fg);
  margin: 30px 0 0;
  max-width: 600px;
}

/* ---------- Section divider (works) ---------- */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--fg);
  margin-bottom: 72px;
}

.section-title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0;
}

.section-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  margin: 0;
}

/* ---------- Work row ---------- */
.work { margin-bottom: 110px; }

.work-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 24px;
  gap: 20px;
}

.work-left {
  display: flex;
  gap: 20px;
  align-items: baseline;
  flex-wrap: wrap;
}

.work-num {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 13px;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

.work-title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 30px;
  letter-spacing: -0.015em;
  margin: 0;
}

.work-sub {
  font-family: var(--font-serif);
  font-style: normal;
  font-weight: 400;
  font-size: 20px;
  color: var(--fg-sub);
}

.work-year {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- Thumb (placeholder system; swap with real imagery) ---------- */
.thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-sm);
  overflow: hidden;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 44px;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  transition: transform 0.4s var(--ease);
}

.thumb:hover { transform: translateY(-4px); }

/* Thumb with real image */

/* Project-specific placeholder identities */
.t-labslop {
  background: #e8e2d0;
  color: #8a1818;
  border: 1px solid #1a1a18;
}

.t-flo {
  background: linear-gradient(135deg, #1a1a2e 0%, #3b2a5f 50%, #8a1e3a 100%);
  color: #f2efe8;
  font-family: var(--font-serif);
  font-style: normal;
  font-weight: 400;
  font-size: 58px;
  text-transform: none;
  letter-spacing: -0.02em;
}

.t-vagrants {
  background: #1a1a18;
  color: #d4c9a8;
  font-family: var(--font-serif);
  font-style: normal;
  font-weight: 300;
  font-size: 58px;
  text-transform: none;
  letter-spacing: -0.025em;
}

.t-pinnacle {
  background: #b83a1f;
  color: #f2efe8;
}

.t-folks {
  background: #5c3a1f;
  color: #e8dcc4;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 62px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.t-keepers {
  background: #2a1a0f;
  color: #c4992a;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 52px;
  text-transform: none;
  letter-spacing: -0.01em;
}

.t-boston250 {
  background: #0e1f3d;
  color: #c8b97a;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 48px;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.work-actions {
  display: flex;
  gap: 8px;
  margin-top: 22px;
  flex-wrap: wrap;
}

/* ---------- Slideshow ---------- */
.slideshow-module {
  margin-bottom: 60px;
}

.slideshow {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-sm);
}

.slideshow-track {
  display: flex;
  transition: transform 0.45s var(--ease);
  will-change: transform;
}

.slideshow-track img {
  min-width: 100%;
  width: 100%;
  height: auto;
  display: block;
}

.slideshow-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  z-index: 2;
  mix-blend-mode: exclusion;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s var(--ease);
}

.slideshow-btn:hover { transform: translateY(-50%) scale(1.35); }
.slideshow-prev { left: 12px; }
.slideshow-next { right: 12px; }

.slideshow-footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 12px;
}

.slideshow-label {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg);
}

.slideshow-count {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
}

/* ---------- Case study pages ---------- */
.case-intro {
  max-width: 820px;
  margin-bottom: 80px;
}

.case-meta-row {
  display: flex;
  gap: 20px;
  align-items: baseline;
  margin-bottom: 20px;
}

.case-title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: clamp(42px, 6vw, 72px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}

.case-sub {
  font-family: var(--font-serif);
  font-style: normal;
  font-weight: 400;
  font-size: 28px;
  color: var(--fg);
  margin: 0 0 24px;
}

.case-desc {
  font-family: var(--font-serif);
  font-style: normal;
  font-weight: 400;
  font-size: 20px;
  line-height: 1.6;
  color: var(--fg-sub);
  max-width: 600px;
  margin: 24px 0 0;
}

.case-body {
  margin-bottom: 80px;
}

.case-img-full {
  margin-bottom: 20px;
}

.case-img-full img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--r-sm);
}

.case-img-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.case-img-grid img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--r-sm);
}

.case-nav {
  display: flex;
  justify-content: space-between;
  margin-bottom: 80px;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s var(--ease);
}

.thumb:hover img { transform: scale(1.04); }

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

/* ---------- Footer ---------- */
.footer {
  margin-top: 160px;
  padding-top: 22px;
  border-top: 1px solid var(--fg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.foot-copy {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.foot-right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- About page ---------- */
.about-hero {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 80px;
  align-items: start;
  margin-bottom: 100px;
}

.about-photo {
  padding-top: 55px;
}

.about-heading {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: clamp(48px, 6vw, 72px);
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 16px 0 32px;
}

.about-bio {
  font-family: var(--font-serif);
  font-size: 20px;
  line-height: 1.6;
  color: var(--fg);
  max-width: 560px;
  margin: 0;
}

.about-bio + .about-bio {
  margin-top: 20px;
}

.about-photo-placeholder {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: var(--rule);
  border-radius: var(--r-sm);
}

.about-photo img {
  width: 100%;
  height: auto;
  border-radius: var(--r-sm);
  display: block;
}

.about-capabilities {
  border-top: 1px solid var(--fg);
  margin-top: 60px;
}

.capability {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 40px;
  align-items: baseline;
  padding: 36px 0;
  border-bottom: 1px solid var(--fg);
}

.capability-title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: clamp(22px, 2.5vw, 32px);
  letter-spacing: -0.01em;
  margin: 0;
}

.capability-desc {
  font-family: var(--font-serif);
  font-size: 20px;
  line-height: 1.5;
  color: var(--fg-sub);
  margin: 0;
}

.about-body {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 60px;
  padding-top: 60px;
  border-top: 1px solid var(--fg);
  margin-bottom: 80px;
}

.about-section-title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0 0 20px;
}

.about-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.about-list li {
  font-family: var(--font-serif);
  font-size: 17px;
  color: var(--fg);
}

.about-currently {
  font-family: var(--font-serif);
  font-style: normal;
  font-size: 17px;
  line-height: 1.5;
  color: var(--fg);
  margin: 0;
}

.about-link {
  color: var(--fg);
  text-decoration: none;
}

.about-link:hover {
  text-decoration: none;
}

.about-cta {
  margin-bottom: 120px;
}

/* ---------- Contact page ---------- */
.contact-hero {
  max-width: 820px;
  margin-bottom: 80px;
}

.contact-heading {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: clamp(60px, 9vw, 120px);
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0 0 28px;
  text-transform: uppercase;
}

.contact-sub {
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 20px;
  line-height: 1.5;
  color: var(--fg);
  margin: 0;
}

.contact-body {
  max-width: 680px;
  margin-bottom: 120px;
}

.contact-form {
  margin-bottom: 60px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 40px;
}

.form-field {
  display: flex;
  flex-direction: column;
  margin-bottom: 36px;
}

.form-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg);
  margin-bottom: 12px;
}

.form-input,
.form-textarea {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 400;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule);
  color: var(--fg);
  padding: 10px 0 10px 8px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s var(--ease);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--fg-muted);
}

.form-input:focus,
.form-textarea:focus {
  border-bottom-color: var(--fg);
}

.form-textarea {
  resize: none;
  min-height: 140px;
  line-height: 1.55;
}

.form-submit {
  margin-top: 8px;
}

.pill--submit {
  padding: 12px 28px;
  font-size: 12px;
}

.contact-direct {
  padding-top: 40px;
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 20px;
}

.contact-direct-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0;
}

/* ---------- Form feedback ---------- */
.form-feedback {
  display: none;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 16px;
}
.form-feedback.is-success { display: block; color: var(--fg); }
.form-feedback.is-error   { display: block; color: var(--fg); opacity: 0.7; }

/* ---------- Hamburger button (hidden on desktop) ---------- */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  z-index: 200;
}

.hamburger span {
  display: block;
  height: 2px;
  width: 100%;
  background: white;
  border-radius: 2px;
  transition: transform 0.22s var(--ease), opacity 0.22s var(--ease);
  transform-origin: center;
}

.hamburger.is-open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.hamburger.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.is-open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ---------- Mobile menu (full-screen overlay) ---------- */
.mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
  z-index: 199;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.25s var(--ease), visibility 0s 0.25s;
  pointer-events: none;
}

.mobile-menu.is-open {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.25s var(--ease);
  pointer-events: auto;
}

.mobile-menu .pill {
  font-size: 14px;
  padding: 12px 32px;
}

.mobile-menu-close {
  position: absolute;
  top: 24px;
  left: 24px;
  background: none;
  border: 1px solid var(--fg);
  border-radius: var(--r-pill);
  color: var(--fg);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.mobile-menu-close:hover {
  background: var(--fg);
  color: var(--bg);
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  :root { --space-gutter: 22px; }

  /* 3-column mobile header: hamburger | logo | toggle */
  .top {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    flex-wrap: unset;
    gap: 0;
  }

  .hamburger {
    display: flex;
    justify-self: start;
  }

  .mark {
    justify-self: center;
  }

  .top-right {
    justify-self: end;
  }

  /* Hide desktop nav pills on mobile */
  .top-right .nav { display: none; }

  .mobile-menu { display: flex; }

  .mob-br { display: block; }
  .top-rule { margin-bottom: 60px; }
  .intro { margin-bottom: 90px; }
  .intro-sub { margin-top: 14px; }
  .work { margin-bottom: 80px; }
  .work-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .work-left { gap: 4px; flex-direction: column; align-items: flex-start; }
  .work-year { align-self: flex-start; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .footer { flex-direction: column; align-items: flex-start; }
  .about-hero { grid-template-columns: 1fr; }
  .about-photo { order: -1; max-width: 280px; margin-left: auto; margin-right: auto; padding-top: 0; }
  .capability { grid-template-columns: 1fr; gap: 12px; }
  .about-body { grid-template-columns: 1fr; gap: 40px; }
  .form-row { grid-template-columns: 1fr; }
  .contact-direct { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* ---------- A11y ---------- */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}
