/* ============================================================
   Jay's Handyman Services — "Work Order"
   Tokens sourced from DESIGN.md — do not hardcode values that
   already have a token below.
   ============================================================ */

:root {
  /* Colors */
  --canvas: #E6E5E0;
  --canvas-dim: #DAD9D1;
  --ink: #241C13;
  --ink-soft: #5A4E3E;
  --ink-faint: #8C7F6C;
  --charcoal: #1E1812;
  --charcoal-panel: #2A2319;
  --on-dark: #F1EAD9;
  --on-dark-soft: #C4B8A2;
  --on-dark-faint: #9C8F79;
  --accent: #D9720A;
  --accent-deep: #8A4409;
  --hairline: #DDD2BE;
  --hairline-on-dark: rgba(241, 234, 217, 0.14);

  /* Type */
  --font-display: "Barlow", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "Source Sans 3", -apple-system, BlinkMacSystemFont, sans-serif;

  --text-xs: 12px;
  --text-sm: 14px;
  --text-ui: 15px;
  --text-base: 16px;
  --text-md: 18px;
  --text-lg: 21px;
  --text-xl: 26px;

  --text-display: clamp(30px, 4.4vw, 50px);
  --text-display-mobile: clamp(28px, 8.5vw, 32px);
  --text-headline: clamp(22px, 3vw, 32px);
  --text-title: 19px;
  --text-stamp: 10px;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  /* Spacing */
  --section-y: clamp(44px, 6.5vw, 88px);
  --section-x: clamp(20px, 5vw, 56px);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   Reset
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  overflow-x: clip;
}
img { max-width: 100%; display: block; }
ul, ol { list-style: none; margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; cursor: pointer; }
input, textarea { font: inherit; }

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--charcoal);
  color: var(--on-dark);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  z-index: 1000;
  transition: top 0.2s var(--ease);
}
.skip-link:focus {
  top: 16px;
}

:focus-visible {
  outline: 2px solid var(--accent-deep);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}
.section-inverted :focus-visible,
.hero :focus-visible,
.footer :focus-visible,
.nav :focus-visible {
  outline-color: var(--accent);
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-deep);
}
.section-inverted .eyebrow,
.hero .eyebrow,
.footer .eyebrow {
  color: var(--accent);
}

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

.section {
  padding: var(--section-y) 0;
  border-top: 1px solid var(--hairline);
}
.section-inverted {
  background: var(--charcoal);
  color: var(--on-dark);
  border-top-color: var(--hairline-on-dark);
}
.section-dim {
  background: var(--canvas-dim);
}

.section-head {
  max-width: 640px;
  margin-bottom: clamp(24px, 3.6vw, 40px);
}
.section-head .eyebrow { margin-bottom: 10px; }
.h2 {
  display: block;
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: var(--text-headline);
  font-weight: 600;
  line-height: 1.1;
  color: var(--ink);
}
.section-inverted .h2 { color: var(--on-dark); }
.section-note {
  margin-top: 10px;
  font-size: var(--text-md);
  color: var(--ink-soft);
  max-width: 52ch;
}
.section-inverted .section-note { color: var(--on-dark-soft); }

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  min-height: 50px;
  padding: 0 26px;
  transition: background-color 0.2s var(--ease), transform 0.2s var(--ease), border-color 0.2s var(--ease);
}
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn-primary {
  background: var(--accent);
  color: var(--charcoal);
}
.btn-primary:hover { background: var(--accent-deep); color: var(--on-dark); transform: translateY(-1px); }
.btn-outline {
  background: transparent;
  color: var(--on-dark);
  border: 1.5px solid var(--hairline-on-dark);
}
.btn-outline:hover { background: rgba(241, 234, 217, 0.08); }
.section:not(.section-inverted) .btn-outline {
  color: var(--ink);
  border-color: var(--hairline);
}
.section:not(.section-inverted) .btn-outline:hover { background: var(--canvas-dim); }

/* ============================================================
   Phone chip
   ============================================================ */

.phone-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  background: var(--accent);
  color: var(--charcoal);
  transition: background-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.phone-chip svg { width: 16px; height: 16px; }
.phone-chip:hover { background: var(--accent-deep); color: var(--on-dark); transform: translateY(-1px); }
.phone-chip-large {
  min-height: 56px;
  padding: 0 26px;
  font-size: var(--text-md);
  margin-bottom: 24px;
}
.phone-chip-large svg { width: 20px; height: 20px; }

/* ============================================================
   Nav
   ============================================================ */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 500;
  background: var(--charcoal);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.nav.is-scrolled {
  border-bottom-color: var(--hairline-on-dark);
  box-shadow: 0 8px 24px rgba(30, 24, 18, 0.28);
}
.nav-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 18px var(--section-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.nav.is-scrolled .nav-inner { padding-top: 12px; padding-bottom: 12px; }

.logo-badge {
  display: flex;
  align-items: center;
  background: var(--canvas);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  transition: transform 0.2s var(--ease);
}
.logo-badge:hover { transform: translateY(-1px); }
.logo-badge-image {
  display: block;
  height: 30px;
  width: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(18px, 2.6vw, 32px);
  flex: 1;
  justify-content: center;
}
.nav-link {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--on-dark-soft);
  transition: color 0.2s var(--ease);
  padding: 6px 2px;
}
.nav-link:hover { color: var(--accent); }

.phone-chip-desktop { flex-shrink: 0; }

.nav-toggle {
  display: none;
  background: transparent;
  border: none;
  padding: 8px;
  color: var(--on-dark);
}
.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  margin: 5px 0;
  transition: transform 0.2s var(--ease), opacity 0.2s var(--ease);
}
.nav-panel { display: none; }

@media (max-width: 780px) {
  .nav-links-desktop, .phone-chip-desktop { display: none; }
  .nav-toggle { display: block; }
  .nav-panel {
    position: fixed;
    inset: 0;
    padding: 90px 24px 32px;
    background: var(--charcoal);
    display: none;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
  }
  .nav-panel.is-open { display: flex; }
  .nav-panel .nav-link {
    color: var(--on-dark-soft);
    font-size: var(--text-md);
    padding: 14px 0;
    border-bottom: 1px solid var(--hairline-on-dark);
  }
  .nav-panel .phone-chip {
    margin-top: 16px;
    justify-content: center;
    min-height: 48px;
  }
  .nav-toggle.is-open .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle.is-open .nav-toggle-bar:nth-child(2) { opacity: 0; }
  .nav-toggle.is-open .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* ============================================================
   Hero — compact ticket band, not a cinematic full-bleed hero
   ============================================================ */

.hero {
  background: var(--charcoal);
  color: var(--on-dark);
  padding: clamp(112px, 14vw, 140px) 0 var(--section-y);
}
.hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--section-x);
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(260px, 380px);
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
}
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; }
}
.hero-content .eyebrow { margin-bottom: 14px; }
.hero-headline {
  font-family: var(--font-display);
  font-size: var(--text-display);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.005em;
  color: var(--on-dark);
}
@media (max-width: 640px) {
  .hero-headline { font-size: var(--text-display-mobile); }
}
.hero-sub {
  margin-top: 14px;
  font-size: var(--text-md);
  color: var(--on-dark-soft);
  max-width: 48ch;
}
.hero-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 26px;
  flex-wrap: wrap;
}

/* ============================================================
   Photo Window — the hero's signature component: a bounded,
   framed rotating photo, not a full-bleed backdrop.
   ============================================================ */

.photo-window {
  position: relative;
}
.photo-window-mat {
  position: relative;
  aspect-ratio: 4 / 5;
  padding: 10px;
  background: var(--canvas-dim);
  border: 1.5px dashed var(--hairline-on-dark);
  border-radius: var(--radius-md);
}
@media (max-width: 860px) {
  .photo-window-mat { aspect-ratio: 16 / 10; }
}
.photo-window-frame {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.photo-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.9s var(--ease);
}
.photo-slide.is-active {
  opacity: 1;
}
.photo-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%;
  display: block;
}
@media (prefers-reduced-motion: reduce) {
  .photo-slide { transition: none; }
}
.photo-window-controls {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
}
.photo-window-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: rgba(30, 24, 18, 0.72);
  color: var(--on-dark);
  border: none;
  border-radius: var(--radius-pill);
  transition: background-color 0.2s var(--ease);
}
.photo-window-toggle[hidden] {
  display: none;
}
.photo-window-toggle:hover { background: rgba(30, 24, 18, 0.9); }
.photo-window-toggle svg { width: 15px; height: 15px; }
.photo-window-toggle .icon-play { display: none; }
.photo-window-toggle.is-paused .icon-play { display: block; }
.photo-window-toggle.is-paused .icon-pause { display: none; }

.stamp-badge {
  position: absolute;
  left: -18px;
  bottom: -18px;
  z-index: 3;
  width: 84px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--accent);
  color: var(--charcoal);
  border: 1.5px dashed var(--charcoal);
  border-radius: var(--radius-pill);
  transform: rotate(-7deg);
}
.stamp-badge-text {
  font-family: var(--font-display);
  font-size: var(--text-stamp);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.stamp-badge-text span {
  display: block;
}
@media (max-width: 480px) {
  .stamp-badge { width: 68px; height: 68px; left: -12px; bottom: -12px; }
}

/* ============================================================
   Services — ticket line-items, not a card grid
   ============================================================ */

.services-list {
  display: flex;
  flex-direction: column;
}
.service-row {
  display: grid;
  grid-template-columns: 48px 32px 1fr;
  grid-template-areas: "index icon body";
  align-items: start;
  gap: 18px;
  padding: 22px 4px;
  border-top: 1.5px dashed var(--hairline);
  transition: box-shadow 0.2s var(--ease);
}
.services-list .service-row:last-child {
  border-bottom: 1.5px dashed var(--hairline);
}
.service-row:hover {
  box-shadow: 0 4px 12px rgba(36, 28, 19, 0.08);
}
@media (max-width: 640px) {
  .service-row {
    grid-template-columns: 40px auto 1fr;
    grid-template-areas: "index icon icon" "body body body";
    row-gap: 10px;
    column-gap: 12px;
  }
}
.service-index {
  grid-area: index;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  border: 1.5px dashed var(--hairline);
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent-deep);
}
.service-icon {
  grid-area: icon;
  width: 26px;
  height: 26px;
  margin-top: 3px;
  color: var(--accent-deep);
}
.service-body {
  grid-area: body;
}
.service-title {
  font-family: var(--font-body);
  font-size: var(--text-title);
  font-weight: 600;
  color: var(--ink);
}
.service-desc {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: var(--text-sm);
}

/* ============================================================
   Contact
   ============================================================ */

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(32px, 4vw, 56px);
}
@media (max-width: 900px) {
  .contact-grid { grid-template-columns: 1fr; }
}
.contact-detail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 0;
  border-top: 1px solid var(--hairline);
}
.contact-detail:last-child { border-bottom: 1px solid var(--hairline); }
.contact-detail-label {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.contact-detail-value {
  font-size: var(--text-md);
  color: var(--ink);
}
.contact-detail-value a:hover { color: var(--accent-deep); }

.form-panel {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-top: 1.5px dashed var(--hairline);
  border-radius: var(--radius-lg);
  padding: clamp(22px, 3vw, 30px);
  min-height: 460px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.form-row { margin-bottom: 16px; }
.form-row-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 480px) {
  .form-row-split { grid-template-columns: 1fr; }
}
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.form-input, .form-textarea {
  width: 100%;
  background: var(--canvas-dim);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: var(--text-base);
  color: var(--ink);
  transition: border-color 0.2s var(--ease);
}
.form-input:focus, .form-textarea:focus {
  border-color: var(--accent-deep);
}
.form-textarea { resize: vertical; min-height: 88px; }
.form-input::placeholder, .form-textarea::placeholder { color: var(--ink-faint); }
.form-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-submit { width: 100%; justify-content: center; margin-top: 2px; }
.form-error {
  display: none;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--accent-deep);
  border-radius: var(--radius-sm);
  color: var(--accent-deep);
  font-size: var(--text-sm);
}
.form-error.is-visible { display: block; }
.form-success {
  display: none;
  min-height: 220px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  gap: 10px;
}
.form-success.is-visible { display: flex; }
.form-success-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--ink);
}
.form-success-desc { color: var(--ink-soft); font-size: var(--text-base); max-width: 36ch; }
.form-body.is-hidden { display: none; }

/* ============================================================
   Footer
   ============================================================ */

.footer {
  background: var(--charcoal);
  color: var(--on-dark-soft);
  padding: 48px 0 88px;
  border-top: 1px solid var(--hairline-on-dark);
}
.footer-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 var(--section-x);
}
.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--hairline-on-dark);
}
.logo-badge-footer .logo-badge-image {
  height: 26px;
}
.footer-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.footer-links a {
  font-size: var(--text-sm);
  color: var(--on-dark-soft);
}
.footer-links a:hover { color: var(--accent); }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding-top: 22px;
  font-size: var(--text-xs);
  color: var(--on-dark-faint);
}

/* ============================================================
   Mobile persistent call bar
   ============================================================ */

.mobile-call-bar {
  display: none;
}
@media (max-width: 780px) {
  .mobile-call-bar {
    display: block;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 600;
    padding: 12px var(--section-x);
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    background: var(--charcoal);
    border-top: 1px solid var(--hairline-on-dark);
  }
  .mobile-call-bar-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    background: var(--accent);
    color: var(--charcoal);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 600;
    border-radius: var(--radius-pill);
  }
  .mobile-call-bar-link svg { width: 18px; height: 18px; }
  /* Body padding so the fixed bar never covers the final section's content */
  .footer { padding-bottom: 88px; }
}

/* ============================================================
   Reveal on scroll
   ============================================================ */

.js-reveal-ready [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
