/* ============================================
   Khise Tooling — Modern Industrial Website
   Design: Dark, precision, copper accent
   ============================================ */

:root {
  /* Palette */
  --bg-dark: #0c0e12;
  --bg-card: #14171e;
  --bg-elevated: #1a1e28;
  --text: #e8eaed;
  --text-muted: #9ca3af;
  --accent: #d4a853;
  --accent-hover: #e4b963;
  --accent-dim: rgba(212, 168, 83, 0.15);
  --border: rgba(255, 255, 255, 0.08);
  --success: #34d399;
  --error: #f87171;

  /* Typography */
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Outfit', system-ui, sans-serif;

  /* Spacing & layout */
  --container: min(1200px, 92vw);
  --section-pad: clamp(4rem, 10vw, 7rem);
  --header-h: 72px;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-dark);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Noise overlay */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s var(--ease-out);
}

ul, ol {
  list-style: none;
}

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

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem);
  min-width: 0;
}

/* ========== Header ========== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(12, 14, 18, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s var(--ease-out), border-color 0.3s;
  overflow: hidden;
}

.header.scrolled {
  background: rgba(12, 14, 18, 0.95);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 1rem;
  min-width: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  flex-shrink: 0;
  min-width: 0;
}

.logo-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--bg-dark);
  border-radius: 8px;
  font-size: 0.85rem;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  min-width: 0;
  flex-shrink: 1;
}

.nav-backdrop {
  display: none;
}

.nav-panel {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-list {
  display: flex;
  gap: clamp(1rem, 2vw, 2rem);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-list a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.4rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.2s var(--ease-out), color 0.2s, transform 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-dark);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-cta {
  padding: 0.6rem 1.2rem;
  font-size: 0.85rem;
}

.btn-full {
  width: 100%;
  padding: 0.9rem;
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.menu-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform 0.3s, opacity 0.3s;
}

/* Tablet/small desktop: show mobile menu so nav doesn't get cut off */
@media (max-width: 1024px) {
  .menu-toggle {
    display: flex;
  }

  /* Right-side drawer: starts below header, no extra top/bottom space */
  .nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    pointer-events: none;
    visibility: hidden;
    transition: visibility 0.3s var(--ease-out);
  }

  .nav.open {
    pointer-events: auto;
    visibility: visible;
  }

  /* Backdrop: dims the page, click to close */
  .nav-backdrop {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s var(--ease-out);
  }

  .nav.open .nav-backdrop {
    opacity: 1;
  }

  /* Panel: slides in from the right, height = content only (no empty space) */
  .nav-panel {
    position: relative;
    z-index: 1;
    width: min(220px, 72vw);
    max-width: 100%;
    height: auto;
    max-height: calc(100dvh - var(--header-h));
    background: var(--bg-elevated);
    border-left: 1px solid var(--border);
    padding: 0.5rem 0.75rem 0.5rem;
    padding-top: calc(0.5rem + env(safe-area-inset-top, 0px));
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
    display: none;
    flex-direction: column;
    gap: 0;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.3);
    transform: translateX(100%);
    transition: transform 0.35s var(--ease-out);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    align-self: flex-start;
  }

  .nav.open .nav-panel {
    display: flex;
    transform: translateX(0);
  }

  .nav-list {
    flex-direction: column;
    gap: 0;
    padding-top: 0;
  }

  .nav-list a {
    display: block;
    padding: 0.3rem 0;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
  }

  .nav .btn-cta {
    margin-top: 0.5rem;
    width: 100%;
    justify-content: center;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
  }
}

/* ========== Hero ========== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: var(--header-h);
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black, transparent);
}

.hero-gradient {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 50% at 50% 20%, var(--accent-dim), transparent 55%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: 3rem 0 5rem;
}

.hero-label {
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 1rem;
  opacity: 0;
  animation: fadeUp 0.7s var(--ease-out) 0.2s forwards;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
  opacity: 0;
  animation: fadeUp 0.7s var(--ease-out) 0.35s forwards;
}

.hero-title .highlight {
  color: var(--accent);
  position: relative;
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-muted);
  max-width: 520px;
  margin-bottom: 2rem;
  opacity: 0;
  animation: fadeUp 0.7s var(--ease-out) 0.5s forwards;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 3.5rem;
  opacity: 0;
  animation: fadeUp 0.7s var(--ease-out) 0.65s forwards;
}

.hero-stats {
  display: flex;
  gap: clamp(2rem, 5vw, 4rem);
  opacity: 0;
  animation: fadeUp 0.7s var(--ease-out) 0.8s forwards;
}

.stat {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hero-scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  border-radius: 1px;
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.5; transform: scaleY(0.6); }
  50% { opacity: 1; transform: scaleY(1); }
}

/* ========== Sections ========== */
.section {
  padding: var(--section-pad) 0;
}

.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 3.5rem;
}

.section-label {
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.section-desc {
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* Animate on scroll (JS will add .visible) */
[data-animate] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

[data-animate].visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========== Services ========== */
.services {
  background: var(--bg-card);
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.service-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  transition: border-color 0.3s, transform 0.3s var(--ease-out);
}

.service-card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-4px);
}

.service-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 1.25rem;
  color: var(--accent);
}

.service-icon svg {
  width: 100%;
  height: 100%;
}

.service-card h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.service-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ========== Work / Portfolio ========== */
.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.work-card {
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: border-color 0.3s, transform 0.3s var(--ease-out);
}

.work-card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-4px);
}

.work-image {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--bg-elevated);
}

.work-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.work-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(12, 14, 18, 0.95) 30%, transparent);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
}

.work-card:hover .work-overlay {
  opacity: 1;
}

.work-tag {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.work-overlay p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.work-card h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  padding: 1.25rem 1.5rem 0.25rem;
}

.work-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0 1.5rem 1.25rem;
}

/* ========== Industries ========== */
.industries {
  background: var(--bg-elevated);
}

.industries-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.industry-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-weight: 500;
  transition: border-color 0.3s, color 0.3s;
}

.industry-item:hover {
  border-color: var(--accent-dim);
  color: var(--accent);
}

.industry-icon {
  font-size: 1.25rem;
}

/* ========== Gallery / Photos ========== */
.gallery {
  background: var(--bg-dark);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.gallery-item {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-elevated);
  cursor: pointer;
  aspect-ratio: 4/3;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s;
}

.gallery-item:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.lightbox.open {
  opacity: 1;
  visibility: visible;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 85vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s;
}

.lightbox-prev {
  left: 1rem;
}

.lightbox-next {
  right: 1rem;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.2);
}

@media (max-width: 600px) {
  .gallery-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }
}

/* Industries: equal-width grid on mobile */
@media (max-width: 768px) {
  .industries-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .industry-item {
    min-width: 0;
    padding: 0.75rem 0.5rem;
    font-size: 0.8rem;
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .industries-list {
    grid-template-columns: 1fr;
  }

  .industry-item {
    justify-content: flex-start;
    text-align: left;
  }
}

/* ========== About ========== */
.about-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

@media (max-width: 800px) {
  .about-inner {
    grid-template-columns: 1fr;
  }
}

.about-content .section-title {
  text-align: left;
}

.about-content .section-label {
  text-align: left;
}

.about-text {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 1.05rem;
}

.about-features {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.about-features li {
  position: relative;
  padding-left: 1.5rem;
  color: var(--text-muted);
}

.about-features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.5rem;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

.about-visual {
  display: flex;
  justify-content: center;
  align-items: center;
}

.about-card {
  background: linear-gradient(145deg, var(--bg-elevated), var(--bg-card));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 3rem;
  min-width: 220px;
  text-align: center;
}

.about-card-inner {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.about-stat {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.about-card span:last-child {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ========== Contact ========== */
.contact {
  background: var(--bg-card);
  padding: clamp(2rem, 5vw, 3.5rem) 0;
}

.contact .section-head {
  margin-bottom: 1.5rem;
}

.contact .section-title {
  font-size: clamp(1.4rem, 3.5vw, 2rem);
}

.contact .section-desc {
  font-size: 0.95rem;
}

.contact-layout {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 2rem;
  max-width: 960px;
  margin: 0 auto;
  align-items: start;
}

@media (max-width: 768px) {
  .contact-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

.contact-info h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.contact-info ul {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.contact-info li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.contact-info strong {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.contact-info a,
.contact-info span {
  color: var(--text);
  font-size: 0.95rem;
}

.contact-info a:hover {
  color: var(--accent);
}

.contact-hours strong {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.contact-hours p {
  color: var(--text);
  font-size: 0.95rem;
}

/* Contact form: compact, fits single view */
.contact-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.form-row-full {
  grid-column: 1 / -1;
}

.form-row label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.contact-form input,
.contact-form select,
.contact-form textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.contact-form textarea {
  resize: vertical;
  min-height: 72px;
  max-height: 140px;
}

.contact-form .btn-full {
  grid-column: 1 / -1;
  padding: 0.6rem 1rem;
  margin-top: 0.25rem;
}

.contact-form .form-feedback {
  grid-column: 1 / -1;
}

@media (max-width: 600px) {
  .contact-form {
    grid-template-columns: 1fr;
  }

  .form-row-half {
    grid-column: 1;
  }
}

.form-feedback {
  font-size: 0.9rem;
  min-height: 1.4em;
}

.form-feedback.success {
  color: var(--success);
}

.form-feedback.error {
  color: var(--error);
}

/* ========== Footer ========== */
.footer {
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
  background: var(--bg-dark);
}

.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.footer-nav {
  display: flex;
  gap: 2rem;
}

.footer-nav a {
  font-size: 0.9rem;
  color: var(--text-muted);
}

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

.footer-bottom p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Footer: responsive so links don't get cut off */
@media (max-width: 1024px) {
  .footer-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
  }

  .footer-nav {
    flex-wrap: wrap;
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .footer-top {
    gap: 1rem;
  }

  .footer-nav {
    gap: 0.75rem;
  }

  .footer-nav a {
    font-size: 0.85rem;
  }
}
