/* =========================================================================
   MDC — Mauchin Design Concepts
   Design system: tokens, theme handling, and structural motifs.

   The visual language is built from the brand mark itself: a hexagonal
   facet formed from three angled planes. That single geometric idea
   repeats through the site as clipped (bevelled) card corners, angled
   section dividers, and a faint isometric "blueprint" grid — rather than
   generic rounded cards or drop shadows.
   ========================================================================= */

:root {
  /* ---- Brand colors (fixed, from brand guide) ---- */
  --gold: #bb8630;
  --gold-dark: #96691f;
  --gold-light: #d7a94f;
  --navy: #0e1b27;
  --paper: #fafafa;
  --ink: #080808;

  /* ---- Light theme (default) ---- */
  --bg: #fafafa;
  --surface: #f1ede4;      /* warm concrete gray-beige, not pure white */
  --surface-2: #e9e3d6;
  --text: #0e1b27;
  --text-muted: #4b5a66;
  --border: rgba(14, 27, 39, 0.12);
  --border-strong: rgba(14, 27, 39, 0.22);
  --nav-bg: rgba(250, 250, 250, 0.86);
  --card-bg: #ffffff;
  --shadow: 0 18px 40px -22px rgba(14, 27, 39, 0.35);
  --blueprint-line: rgba(14, 27, 39, 0.06);
  --overlay-scrim: linear-gradient(180deg, rgba(8,12,16,.15), rgba(8,12,16,.72));

  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body: 'IBM Plex Sans', 'Segoe UI', sans-serif;
}

html[data-theme='dark'] {
  --bg: #0a141d;
  --surface: #101f2c;
  --surface-2: #16283a;
  --text: #fafafa;
  --text-muted: #9fb0bc;
  --border: rgba(250, 250, 250, 0.12);
  --border-strong: rgba(250, 250, 250, 0.22);
  --nav-bg: rgba(10, 20, 29, 0.82);
  --card-bg: #122232;
  --shadow: 0 22px 44px -20px rgba(0, 0, 0, 0.6);
  --blueprint-line: rgba(250, 250, 250, 0.055);
  --overlay-scrim: linear-gradient(180deg, rgba(4,8,12,.25), rgba(4,8,12,.82));
}

/* Prevent flash: theme is set before paint via inline script in <head> */
html { color-scheme: light; }
html[data-theme='dark'] { color-scheme: dark; }

* { box-sizing: border-box; }

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background-color .35s ease, color .35s ease;
}

h1, h2, h3, h4, .font-display {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

.text-muted { color: var(--text-muted); }
.bg-surface { background-color: var(--surface); }
.bg-surface-2 { background-color: var(--surface-2); }
.border-token { border-color: var(--border); }

::selection { background: var(--gold); color: #0e1b27; }

a { color: inherit; }

/* Visible keyboard focus (accessibility floor) */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================================
   Blueprint grid backdrop — faint isometric technical-drawing texture
   ========================================================================= */
.blueprint-grid {
  background-image:
    linear-gradient(var(--blueprint-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--blueprint-line) 1px, transparent 1px);
  background-size: 44px 44px;
}

.blueprint-diag {
  background-image: repeating-linear-gradient(
    -45deg,
    var(--blueprint-line) 0 1px,
    transparent 1px 26px
  );
}

/* =========================================================================
   Facet / clipped-corner motif — the brand's angled plane, reused as a
   structural device on cards, buttons and image frames.
   ========================================================================= */
.facet {
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 0 100%);
}
.facet-sm {
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
}
.facet-rev {
  clip-path: polygon(22px 0, 100% 0, 100% 100%, 0 100%, 0 22px);
}
.facet-both {
  clip-path: polygon(24px 0, 100% 0, 100% calc(100% - 24px), calc(100% - 24px) 100%, 0 100%, 0 24px);
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* Technical-drawing corner brackets, used instead of card shadows-only */
.corner-marks { position: relative; }
.corner-marks::before,
.corner-marks::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--gold);
  opacity: .85;
  pointer-events: none;
}
.corner-marks::before {
  top: -1px; left: -1px;
  border-right: none; border-bottom: none;
}
.corner-marks::after {
  bottom: -1px; right: -1px;
  border-left: none; border-top: none;
}

/* =========================================================================
   Buttons
   ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .85rem 1.6rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: .95rem;
  letter-spacing: .01em;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
  transition: transform .25s ease, background-color .25s ease, color .25s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--gold);
  color: #14100a;
}
.btn-primary:hover { background: var(--gold-light); transform: translateY(-2px); }
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border-strong);
}
.btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold);
  transform: translateY(-2px);
}
.btn-ghost-dark {
  background: transparent;
  color: var(--paper);
  border: 1.5px solid rgba(250,250,250,.35);
}
.btn-ghost-dark:hover { border-color: var(--gold); color: var(--gold-light); }

/* =========================================================================
   Nav
   ========================================================================= */
.site-nav {
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav-link {
  position: relative;
  font-family: var(--font-display);
  font-size: .93rem;
}
.nav-link::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s ease;
}
.nav-link:hover::after,
.nav-link.active::after { transform: scaleX(1); }
.nav-link.active { color: var(--gold); }

/* =========================================================================
   Preloader — logo mark centered in a rotating ring
   ========================================================================= */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  transition: opacity .5s ease, visibility .5s ease;
}
#preloader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.preloader-ring-wrap {
  position: relative;
  width: 128px;
  height: 128px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preloader-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2.5px solid rgba(250,250,250,.12);
  border-top-color: var(--gold);
  border-right-color: var(--gold-light);
  animation: mdc-spin 1.1s linear infinite;
}
.preloader-mark {
  width: 58px;
  height: 58px;
  object-fit: contain;
  animation: mdc-pulse 1.8s ease-in-out infinite;
}
@keyframes mdc-spin { to { transform: rotate(360deg); } }
@keyframes mdc-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* =========================================================================
   Theme toggle switch
   ========================================================================= */
.theme-toggle {
  position: relative;
  width: 52px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  cursor: pointer;
  flex-shrink: 0;
}
.theme-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gold);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  display: flex;
  align-items: center;
  justify-content: center;
}
html[data-theme='dark'] .theme-toggle-knob { transform: translateX(24px); }
.theme-toggle svg { width: 13px; height: 13px; }

/* =========================================================================
   Misc components
   ========================================================================= */
.eyebrow-mark {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-display);
  font-size: .8rem;
  color: var(--gold);
}
.eyebrow-mark::before {
  content: '';
  width: 22px;
  height: 2px;
  background: var(--gold);
}

.hex-bullet {
  width: 8px;
  height: 8px;
  background: var(--gold);
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
  flex-shrink: 0;
}

.accordion-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s ease;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s ease, transform .7s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: mdc-marquee 32s linear infinite;
}
@keyframes mdc-marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.marquee-wrap:hover .marquee-track { animation-play-state: paused; }

.carousel-track {
  display: flex;
  transition: transform .55s cubic-bezier(.65,0,.35,1);
}

input, textarea, select {
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
}
input:focus, textarea:focus, select:focus {
  border-color: var(--gold);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }

.status-pill {
  font-family: var(--font-display);
  font-size: .72rem;
  letter-spacing: .02em;
  padding: .25rem .65rem;
  display: inline-block;
}
.status-ongoing { background: rgba(187,134,48,.16); color: var(--gold); }
.status-completed { background: rgba(34,197,94,.14); color: #2f9e5f; }
html[data-theme='dark'] .status-completed { color: #52c97f; }

table.admin-table th {
  font-family: var(--font-display);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}
table.admin-table td, table.admin-table th {
  border-bottom: 1px solid var(--border);
}

/* Logo swap between light/dark variants based on active theme */
.logo-for-light { display: block; }
.logo-for-dark { display: none; }
html[data-theme='dark'] .logo-for-light { display: none; }
html[data-theme='dark'] .logo-for-dark { display: block; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
