/* ==========================================================================
   stirlinghepburn.com — craftsman-meets-tech
   ========================================================================== */

/* ---------- Theme tokens ---------- */
:root {
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, "Segoe UI", sans-serif;
  --radius: 14px;
  --max-width: 1100px;
  --header-h: 72px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1c130d;
  --bg-deep: #150e09;
  --surface: #281b12;
  --surface-2: #32231766;
  --border: #4a3522;
  --text: #f3e9dc;
  --text-soft: #c9b8a4;
  --accent-orange: #f08a3c;
  --accent-orange-soft: #f08a3c33;
  --accent-blue: #8cc9f0;
  --accent-blue-deep: #5fa8d6;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.65);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #faf4ea;
  --bg-deep: #f1e7d8;
  --surface: #fffdf8;
  --surface-2: #f4ead933;
  --border: #e0d2bd;
  --text: #2c2014;
  --text-soft: #6d5b46;
  --accent-orange: #c2590f;
  --accent-orange-soft: #c2590f22;
  --accent-blue: #1f6fa8;
  --accent-blue-deep: #185a89;
  --shadow: 0 18px 45px -22px rgba(80, 55, 25, 0.35);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  transition: background-color 0.4s ease, color 0.4s ease;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.12;
  margin: 0 0 0.6em;
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 1.1em;
}

a {
  color: var(--accent-blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-orange);
}

img {
  max-width: 100%;
  height: auto;
}

strong {
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--accent-orange);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  top: -48px;
  left: 12px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent-orange);
  color: var(--bg);
  border-radius: 0 0 8px 8px;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
}

/* ---------- Custom cursor ---------- */
.cursor-dot,
.cursor-ring {
  display: none;
}

body.has-custom-cursor {
  cursor: none;
}

body.has-custom-cursor a,
body.has-custom-cursor button,
body.has-custom-cursor input,
body.has-custom-cursor textarea,
body.has-custom-cursor [tabindex] {
  cursor: none;
}

body.has-custom-cursor .cursor-dot,
body.has-custom-cursor .cursor-ring {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  pointer-events: none;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.cursor-dot {
  width: 7px;
  height: 7px;
  background: var(--accent-orange);
}

.cursor-ring {
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--accent-blue);
  opacity: 0.7;
  transition: width 0.25s var(--ease), height 0.25s var(--ease),
    opacity 0.25s ease, border-color 0.25s ease;
}

body.cursor-hovering .cursor-ring {
  width: 56px;
  height: 56px;
  border-color: var(--accent-orange);
  opacity: 1;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  height: var(--header-h);
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}

.brand img {
  border-radius: 50%;
}

.site-nav {
  margin-left: auto;
}

.site-nav ul {
  display: flex;
  gap: clamp(0.75rem, 2.5vw, 1.75rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-soft);
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-nav a:hover {
  color: var(--accent-orange);
}

.site-nav .nav-cta {
  color: var(--accent-orange);
  font-weight: 600;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s ease, transform 0.2s var(--ease);
}

.theme-toggle:hover {
  border-color: var(--accent-orange);
}

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

/* ---------- Buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.6rem;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font-family: var(--font-body);
  font-size: 0.97rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.25s var(--ease), box-shadow 0.25s ease,
    background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.button.primary {
  background: var(--accent-orange);
  color: #1c130d;
}

.button.primary:hover {
  box-shadow: 0 8px 28px -8px var(--accent-orange);
  transform: translateY(-2px);
  color: #1c130d;
}

.button.ghost {
  border-color: var(--border);
  background: transparent;
  color: var(--text);
}

.button.ghost:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  transform: translateY(-2px);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: calc(var(--header-h) + 2rem) clamp(1.25rem, 5vw, 3rem) 4rem;
}

.hero-canvas-wrap {
  position: absolute;
  inset: 0;
  z-index: 0;
}

#hero-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* static fallback glow when WebGL/motion unavailable */
.hero-canvas-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 50% 45% at 68% 38%, var(--accent-orange-soft), transparent 70%),
    radial-gradient(ellipse 42% 40% at 30% 68%, color-mix(in srgb, var(--accent-blue) 14%, transparent), transparent 70%);
  opacity: 1;
  transition: opacity 0.8s ease;
}

.hero.canvas-live .hero-canvas-wrap::before {
  opacity: 0.35;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 820px;
  text-align: center;
}

.hero-eyebrow {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-blue);
  margin-bottom: 1.4rem;
}

.hero-title {
  font-size: clamp(1.9rem, 4.6vw, 3.4rem);
  font-weight: 600;
  margin-bottom: 1.2rem;
}

.hero-sub {
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  color: var(--text-soft);
  max-width: 620px;
  margin: 0 auto 2.2rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  justify-content: center;
}

.scroll-cue {
  position: absolute;
  bottom: 1.6rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.72rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.scroll-cue-line {
  width: 1.5px;
  height: 38px;
  background: linear-gradient(var(--accent-orange), transparent);
  animation: cue-drop 2s var(--ease) infinite;
  transform-origin: top;
}

@keyframes cue-drop {
  0% { transform: scaleY(0); }
  45% { transform: scaleY(1); }
  100% { transform: scaleY(0); opacity: 0; }
}

/* ---------- Sections ---------- */
.section {
  padding: clamp(4.5rem, 10vw, 7.5rem) clamp(1.25rem, 5vw, 3rem);
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-title {
  font-size: clamp(1.8rem, 3.6vw, 2.7rem);
  font-weight: 600;
}

.section-title::after {
  content: "";
  display: block;
  width: 58px;
  height: 3px;
  margin-top: 0.55rem;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-orange), var(--accent-blue));
}

.section-lede {
  font-size: 1.15rem;
  color: var(--text-soft);
  max-width: 640px;
  margin-bottom: 3rem;
}

/* ---------- About ---------- */
.about {
  background: var(--bg-deep);
}

.spotlight {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.about-photo {
  margin: 0;
}

.about-photo img {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.pull-quote {
  max-width: 760px;
  margin: clamp(3rem, 7vw, 5rem) auto 0;
  padding: 0 1rem;
  text-align: center;
  border: 0;
}

.pull-quote p {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  font-style: italic;
  color: var(--accent-orange);
  margin-bottom: 0.5rem;
}

.pull-quote cite {
  font-style: normal;
  font-size: 0.95rem;
  color: var(--text-soft);
  letter-spacing: 0.08em;
}

/* ---------- Capabilities ---------- */
.cap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.cap-card {
  padding: 1.7rem 1.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.3s var(--ease), border-color 0.3s ease, box-shadow 0.3s ease;
}

.cap-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-blue);
  box-shadow: var(--shadow);
}

.cap-card h3 {
  font-size: 1.18rem;
  color: var(--accent-orange);
}

.cap-card p {
  margin: 0;
  font-size: 0.97rem;
  color: var(--text-soft);
}

/* ---------- Work ---------- */
.work {
  background: var(--bg-deep);
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.4rem;
}

.work-card {
  position: relative;
  padding: 1.8rem 1.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.3s var(--ease), border-color 0.3s ease, box-shadow 0.3s ease;
  will-change: transform;
}

.work-card:hover,
.work-card:focus-visible {
  border-color: var(--accent-orange);
  box-shadow: var(--shadow);
}

.work-thumb {
  margin: 0 0 1.2rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 6px);
  overflow: hidden;
}

.work-thumb img {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: cover;
  object-position: top;
  transition: transform 0.4s var(--ease);
}

.work-card:hover .work-thumb img,
.work-card:focus-visible .work-thumb img {
  transform: scale(1.03);
}

.work-card h3 {
  font-size: 1.25rem;
}

.work-card p {
  font-size: 0.97rem;
  color: var(--text-soft);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  list-style: none;
  margin: 1.1rem 0 0;
  padding: 0;
}

.tags li {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  color: var(--accent-blue);
  border: 1px solid color-mix(in srgb, var(--accent-blue) 45%, transparent);
}

/* ---------- Local (lead gen) ---------- */
.local {
  background:
    radial-gradient(ellipse 70% 60% at 85% 10%, var(--accent-orange-soft), transparent 65%),
    var(--bg);
}

.local-eyebrow {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-orange);
  margin-bottom: 0.8rem;
}

.local .section-title {
  max-width: 760px;
}

.local-cols {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  margin-top: 2.5rem;
  align-items: start;
}

.local-points {
  list-style: none;
  margin: 1.6rem 0 0;
  padding: 0;
}

.local-points li {
  position: relative;
  padding-left: 1.7rem;
  margin-bottom: 1rem;
  color: var(--text-soft);
}

.local-points li::before {
  content: "✦";
  position: absolute;
  left: 0;
  color: var(--accent-orange);
}

.local-form {
  padding: 1.9rem 1.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.local-form h3 {
  font-size: 1.35rem;
  color: var(--accent-orange);
}

.field {
  margin-bottom: 1.1rem;
}

.field label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  transition: border-color 0.2s ease;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.field textarea {
  resize: vertical;
}

.local-form .button {
  width: 100%;
  border: 0;
  cursor: pointer;
}

.form-note {
  margin: 0.9rem 0 0;
  font-size: 0.82rem;
  color: var(--text-soft);
}

/* ---------- Contact ---------- */
.contact {
  text-align: center;
  background: var(--bg-deep);
}

.contact .section-title::after {
  margin-left: auto;
  margin-right: auto;
}

.contact .section-lede {
  margin-left: auto;
  margin-right: auto;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  justify-content: center;
}

/* ---------- Footer ---------- */
.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  padding: 2.5rem 1.25rem 3rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.site-footer p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-soft);
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .spotlight,
  .local-cols {
    grid-template-columns: 1fr;
  }

  .about-photo {
    order: -1;
    max-width: 380px;
  }

  .site-nav ul li:not(:nth-last-child(-n+2)) {
    display: none; /* keep Local Websites + Contact on small screens */
  }
}

@media (max-width: 480px) {
  .site-nav ul li:not(:last-child) {
    display: none;
  }

  .hero-actions .button {
    width: 100%;
  }
}

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .scroll-cue-line {
    animation: none;
  }
}
