/* style.css — Ortiz Engineering Component Styles */

/* ===== SKIP LINK ===== */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  z-index: 100;
  font-size: var(--text-sm);
}
.skip-link:focus {
  top: var(--space-2);
}

/* ===== HEADER / NAV ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: oklch(from var(--color-bg) l c h / 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid oklch(from var(--color-text) l c h / 0.08);
  transition: box-shadow 0.3s var(--ease-out);
}
.site-header--scrolled {
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: var(--content-wide);
  margin-inline: auto;
  padding: var(--space-4) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--color-text);
}
.logo svg {
  width: 40px;
  height: 40px;
}
.logo-wordmark {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1;
}
.logo-sub {
  font-family: var(--font-body);
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  display: block;
  margin-top: 2px;
}

/* Desktop Nav */
.nav-desktop {
  display: none;
  align-items: center;
  gap: var(--space-6);
}
.nav-desktop a {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  letter-spacing: 0.02em;
  position: relative;
}
.nav-desktop a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-primary);
  transition: width var(--transition-interactive);
}
.nav-desktop a:hover,
.nav-desktop a.active {
  color: var(--color-text);
}
.nav-desktop a:hover::after,
.nav-desktop a.active::after {
  width: 100%;
}

.mobile-toggle {
  display: inline-flex;
}

@media (min-width: 768px) {
  .nav-desktop { display: flex; }
  .hamburger { display: none !important; }
  .mobile-toggle { display: none !important; }
}

/* Theme Toggle */
.theme-toggle {
  padding: var(--space-2);
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
}
.theme-toggle:hover {
  color: var(--color-text);
  background: var(--color-surface-offset);
}

/* Hamburger */
.hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: var(--space-2);
  width: 44px;
  height: 44px;
  justify-content: center;
  align-items: center;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 1px;
  transition: transform 0.3s var(--ease-out), opacity 0.3s var(--ease-out);
}
.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
}
.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Nav */
.nav-mobile {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-bg);
  z-index: 40;
  padding: calc(var(--space-16) + var(--space-12)) var(--space-6) var(--space-8);
  flex-direction: column;
  gap: var(--space-2);
}
.nav-mobile.open {
  display: flex;
}
.nav-mobile a {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-text);
  text-decoration: none;
  padding: var(--space-3) 0;
  border-bottom: 1px solid oklch(from var(--color-text) l c h / 0.08);
}
.nav-mobile a:hover {
  color: var(--color-primary);
}

/* ===== HERO ===== */
.hero {
  position: relative;
  min-height: 85vh;
  display: flex;
  align-items: flex-end;
  padding: var(--space-16) var(--space-4) var(--space-12);
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    oklch(0.1 0.01 250 / 0.92) 0%,
    oklch(0.15 0.01 250 / 0.75) 40%,
    oklch(0.2 0.01 250 / 0.5) 100%
  );
}
.hero-content {
  position: relative;
  z-index: 1;
  max-width: var(--content-wide);
  margin-inline: auto;
  width: 100%;
  color: #F5F3EF;
}
.hero-eyebrow {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: var(--space-4);
  opacity: 0.7;
}
.hero h1 {
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: var(--space-4);
  max-width: 16ch;
}
.hero-description {
  font-size: var(--text-base);
  line-height: 1.6;
  max-width: 52ch;
  opacity: 0.85;
  margin-bottom: var(--space-8);
}
.hero .btn {
  color: #F5F3EF;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-sm);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: background var(--transition-interactive),
              color var(--transition-interactive),
              transform var(--transition-interactive),
              box-shadow var(--transition-interactive);
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}
.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-md);
}
.btn-outline {
  border: 1px solid currentColor;
  color: var(--color-primary);
  background: transparent;
}
.btn-outline:hover {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}
.btn-ghost {
  color: var(--color-text);
  padding: var(--space-2) var(--space-4);
}
.btn-ghost:hover {
  background: var(--color-surface-offset);
}

/* ===== SECTIONS ===== */
.section {
  padding: clamp(var(--space-12), 8vw, var(--space-24)) var(--space-4);
}
.section-alt {
  background: var(--color-surface);
}
.section-offset {
  background: var(--color-surface-offset);
}
.container {
  max-width: var(--content-wide);
  margin-inline: auto;
}
.container-narrow {
  max-width: var(--content-default);
  margin-inline: auto;
}

/* Section headers */
.section-eyebrow {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-3);
}
.section-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-4);
}
.section-desc {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: 56ch;
  line-height: 1.6;
}

/* ===== STATS ===== */
.stats-bar {
  background: var(--color-primary);
  padding: var(--space-10) var(--space-4);
}
.stats-grid {
  max-width: var(--content-wide);
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}
.stat-item {
  text-align: center;
}
.stat-value {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: #F5F3EF;
  line-height: 1.2;
}
.stat-label {
  font-size: var(--text-xs);
  color: oklch(from #F5F3EF l c h / 0.7);
  letter-spacing: 0.05em;
  margin-top: var(--space-1);
}

@media (min-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ===== SERVICES (Alternating Layout) ===== */
.service-block {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
  align-items: center;
  padding: clamp(var(--space-8), 6vw, var(--space-16)) 0;
  border-bottom: 1px solid oklch(from var(--color-text) l c h / 0.06);
}
.service-block:last-child {
  border-bottom: none;
}
.service-block-visual {
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4/3;
}
.service-block-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.service-block-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.service-number {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: oklch(from var(--color-primary) l c h / 0.15);
  line-height: 1;
}
.service-block h3 {
  font-size: var(--text-lg);
  font-weight: 700;
}
.service-block p {
  color: var(--color-text-muted);
  line-height: 1.7;
}
.service-price {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-primary);
  margin-top: var(--space-2);
}
.service-deliverables {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.service-deliverables li {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  padding-left: var(--space-5);
  position: relative;
}
.service-deliverables li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 8px;
  height: 2px;
  background: var(--color-primary);
}

@media (min-width: 768px) {
  .service-block {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-12);
  }
  .service-block:nth-child(even) .service-block-visual {
    order: 2;
  }
  .service-block:nth-child(even) .service-block-content {
    order: 1;
  }
}

/* ===== SERVICES PREVIEW (Home Page) ===== */
.services-preview-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  margin-top: var(--space-8);
}
.service-preview-card {
  padding: var(--space-6);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid oklch(from var(--color-text) l c h / 0.06);
  transition: box-shadow var(--transition-interactive), transform var(--transition-interactive);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.service-preview-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.service-preview-card h3 {
  font-size: var(--text-lg);
  font-weight: 600;
}
.service-preview-card p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
}
.service-preview-price {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-primary);
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: 1px solid oklch(from var(--color-text) l c h / 0.06);
}

@media (min-width: 768px) {
  .services-preview-grid {
    grid-template-columns: 1fr 1fr;
  }
  .services-preview-grid .service-preview-card:first-child {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
    align-items: center;
  }
}

/* ===== ABOUT ===== */
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
  align-items: start;
}
.about-image {
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.about-image img {
  width: 100%;
  height: auto;
  object-fit: cover;
}
.about-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.about-content h2 {
  font-size: var(--text-xl);
  font-weight: 700;
}
.about-content p {
  color: var(--color-text-muted);
  line-height: 1.7;
}
.credentials-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  margin-top: var(--space-4);
}
.credential-item {
  padding: var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid oklch(from var(--color-text) l c h / 0.06);
}
.credential-item h4 {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-1);
}
.credential-item p {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

@media (min-width: 768px) {
  .about-grid {
    grid-template-columns: 5fr 7fr;
    gap: var(--space-12);
  }
  .about-image {
    position: sticky;
    top: calc(var(--space-16) + var(--space-4));
  }
  .credentials-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ===== INSIGHTS (Magazine Layout) ===== */
.insights-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  margin-top: var(--space-8);
}
.article-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--color-text);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid oklch(from var(--color-text) l c h / 0.06);
  transition: box-shadow var(--transition-interactive), transform var(--transition-interactive);
}
.article-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.article-card-image {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--color-surface-offset);
}
.article-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out);
}
.article-card:hover .article-card-image img {
  transform: scale(1.04);
}
.article-card-body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
}
.article-tag {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary);
}
.article-card h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.3;
}
.article-card p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
}
.article-meta {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: 1px solid oklch(from var(--color-text) l c h / 0.06);
}

@media (min-width: 768px) {
  .insights-grid {
    grid-template-columns: 7fr 5fr;
    grid-template-rows: auto auto;
  }
  .insights-grid .article-card:first-child {
    grid-row: 1 / 3;
  }
  .insights-grid .article-card:first-child .article-card-image {
    aspect-ratio: 4/3;
  }
  .insights-grid .article-card:first-child .article-card-body {
    padding: var(--space-6);
  }
  .insights-grid .article-card:first-child h3 {
    font-size: var(--text-xl);
  }
}

/* ===== CONTACT ===== */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
}
.contact-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.form-group label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
}
.form-group input,
.form-group textarea,
.form-group select {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  font-size: var(--text-base);
  transition: border-color var(--transition-interactive), box-shadow var(--transition-interactive);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px oklch(from var(--color-primary) l c h / 0.15);
}
.form-group textarea {
  min-height: 140px;
  resize: vertical;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .form-row {
    grid-template-columns: 1fr 1fr;
  }
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.contact-info-block h3 {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--color-text);
}
.contact-info-block p,
.contact-info-block a {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  line-height: 1.7;
}
.contact-info-block a:hover {
  color: var(--color-primary);
}

@media (min-width: 768px) {
  .contact-grid {
    grid-template-columns: 7fr 5fr;
    gap: var(--space-12);
  }
}

/* ===== FOOTER ===== */
.site-footer {
  border-top: 1px solid oklch(from var(--color-text) l c h / 0.08);
  padding: var(--space-10) var(--space-4) var(--space-6);
  background: var(--color-bg);
}
.footer-inner {
  max-width: var(--content-wide);
  margin-inline: auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
}
.footer-brand p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: 36ch;
  margin-top: var(--space-3);
}
.footer-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}
.footer-col h4 {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text);
  margin-bottom: var(--space-3);
}
.footer-col ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.footer-col a {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: none;
}
.footer-col a:hover {
  color: var(--color-text);
}
.footer-bottom {
  max-width: var(--content-wide);
  margin-inline: auto;
  margin-top: var(--space-8);
  padding-top: var(--space-4);
  border-top: 1px solid oklch(from var(--color-text) l c h / 0.06);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.footer-bottom a {
  color: var(--color-text-faint);
  text-decoration: none;
}
.footer-bottom a:hover {
  color: var(--color-text-muted);
}

@media (min-width: 768px) {
  .footer-inner {
    grid-template-columns: 2fr 3fr;
  }
}

/* ===== CTA Section ===== */
.cta-section {
  background: var(--color-primary);
  padding: clamp(var(--space-12), 8vw, var(--space-20)) var(--space-4);
  text-align: center;
}
.cta-section h2 {
  font-size: var(--text-xl);
  color: #F5F3EF;
  margin-bottom: var(--space-3);
}
.cta-section p {
  color: oklch(from #F5F3EF l c h / 0.8);
  max-width: 48ch;
  margin-inline: auto;
  margin-bottom: var(--space-6);
}
.cta-section .btn-primary {
  background: #F5F3EF;
  color: var(--color-primary);
}
.cta-section .btn-primary:hover {
  background: #FFFFFF;
}

/* ===== PAGE HERO (interior pages) ===== */
.page-hero {
  padding: clamp(var(--space-12), 8vw, var(--space-20)) var(--space-4);
  padding-top: clamp(var(--space-16), 10vw, var(--space-24));
  background: var(--color-surface);
  border-bottom: 1px solid oklch(from var(--color-text) l c h / 0.06);
}
.page-hero .container {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.page-hero h1 {
  font-size: var(--text-2xl);
  font-weight: 700;
}
.page-hero .lead {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: 56ch;
  line-height: 1.6;
}

/* ===== SCROLL ANIMATIONS ===== */
/* CSS-native scroll-driven (Chrome 115+) */
.fade-in {
  opacity: 1;
}

@supports (animation-timeline: scroll()) {
  .fade-in {
    opacity: 0;
    animation: reveal-fade linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 100%;
  }
}

@keyframes reveal-fade {
  to { opacity: 1; }
}

.reveal-up {
  opacity: 1;
}

@supports (animation-timeline: scroll()) {
  .reveal-up {
    clip-path: inset(100% 0 0 0);
    animation: reveal-clip linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 100%;
  }
}

@keyframes reveal-clip {
  to { clip-path: inset(0 0 0 0); }
}

/* JS fallback: IntersectionObserver adds .is-visible */
.fade-in.js-scroll {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.fade-in.js-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== EXPERIENCE TIMELINE (About page) ===== */
.experience-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding-left: var(--space-6);
  border-left: 2px solid oklch(from var(--color-primary) l c h / 0.2);
  margin-top: var(--space-6);
}
.experience-item {
  position: relative;
}
.experience-item::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--space-6) - 5px);
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
}
.experience-item h4 {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
}
.experience-item .year {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-bottom: var(--space-1);
}
.experience-item p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

/* ===== SERVICES PAGE HEADER IMAGE ===== */
.services-hero-image {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-8);
}

/* ===== UTILITY ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.mt-auto { margin-top: auto; }
