/* ============================================
   devczr.com - Fire Service Tools
   ============================================ */

:root {
  --bg: #0f1419;
  --bg-deep: #0b1118;
  --bg-card: rgba(26, 35, 50, 0.68);
  --text: #ece8e2;
  --text-muted: #94a1b2;
  --red: #c53030;
  --red-light: #ef4d4d;
  --gold: #d4a24e;
  --gold-soft: rgba(212, 162, 78, 0.35);
  --gold-dim: rgba(212, 162, 78, 0.14);
  --navy: #1a2332;
  --card-border: rgba(212, 162, 78, 0.14);
  --card-border-strong: rgba(212, 162, 78, 0.28);
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --ease-standard: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--sans);
  background:
    radial-gradient(1300px circle at 14% -20%, rgba(212, 162, 78, 0.08), transparent 58%),
    radial-gradient(900px circle at 88% 18%, rgba(197, 48, 48, 0.09), transparent 65%),
    linear-gradient(180deg, #0f1419 0%, #0d141c 40%, #0b1118 100%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

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

/* --- Ember Canvas --- */
#embers {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* --- Navigation --- */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 2.75rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: linear-gradient(180deg, rgba(12, 18, 27, 0.9), rgba(12, 18, 27, 0.76));
  border-bottom: 1px solid rgba(212, 162, 78, 0.09);
  box-shadow: 0 8px 24px rgba(3, 7, 12, 0.45), inset 0 -1px 0 rgba(255, 255, 255, 0.02);
}

.nav-logo {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: var(--gold);
  text-decoration: none;
  transition: color 0.3s ease;
}

.nav-logo:hover {
  color: #e5b973;
}

.nav-links {
  display: flex;
  gap: 1.75rem;
}

.nav-links a {
  position: relative;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.035em;
  transition: color 0.3s ease;
}

.nav-links a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -0.45rem;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0;
  transform: scaleX(0.55);
  transform-origin: center;
  transition: opacity 0.35s var(--ease-standard), transform 0.35s var(--ease-standard);
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--gold);
}

.nav-links a:hover::after,
.nav-links a:focus-visible::after {
  opacity: 0.9;
  transform: scaleX(1);
}

.nav-links a:focus-visible,
.nav-logo:focus-visible {
  outline: 2px solid rgba(212, 162, 78, 0.6);
  outline-offset: 0.3rem;
  border-radius: 2px;
}

/* --- Main Layout --- */
main {
  position: relative;
  z-index: 1;
}

main::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(700px circle at 70% 26%, rgba(212, 162, 78, 0.08), transparent 70%),
    radial-gradient(900px circle at 22% 74%, rgba(197, 48, 48, 0.07), transparent 72%);
}

/* --- Hero Section --- */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  padding: 8.4rem 3rem 2.6rem;
  gap: 3.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.hero-content {
  padding-left: 0.5rem;
  max-width: 34rem;
}

h1 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.hero-line {
  display: block;
  font-size: clamp(3rem, 5.7vw, 4.9rem);
  color: var(--text);
}

.hero-line.accent {
  font-style: italic;
  color: var(--red-light);
  text-shadow: 0 8px 28px rgba(197, 48, 48, 0.22);
}

.hero-sub {
  margin-top: 1.6rem;
  font-size: 1rem;
  line-height: 1.82;
  color: var(--text-muted);
  font-weight: 350;
  letter-spacing: 0.002em;
  max-width: 42ch;
}

/* --- Maltese Visual --- */
.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 360px;
}

.maltese-container {
  position: relative;
  width: 100%;
  max-width: 320px;
  opacity: 0.8;
  margin: 0 auto;
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

.maltese-container::before {
  content: '';
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 162, 78, 0.14) 0%, rgba(197, 48, 48, 0.1) 36%, transparent 74%);
  filter: blur(26px);
  opacity: 0.62;
  pointer-events: none;
}

.maltese {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 32px rgba(212, 162, 78, 0.08)) drop-shadow(0 0 22px rgba(197, 48, 48, 0.09));
}

/* Stroke-led mark motion */
.maltese-system {
  transform-origin: 200px 200px;
  animation: mark-breathe 9.5s ease-in-out infinite;
}

.maltese-orbit,
.maltese-orbit-inner {
  fill: none;
  stroke-linecap: round;
  transform-origin: 200px 200px;
}

.maltese-orbit {
  stroke: rgba(212, 162, 78, 0.28);
  stroke-width: 0.95;
  stroke-dasharray: 2.5 10;
  animation: orbit-drift 108s linear infinite;
}

.maltese-orbit-inner {
  stroke: rgba(197, 48, 48, 0.24);
  stroke-width: 0.85;
  stroke-dasharray: 2 9;
  animation: orbit-drift 86s linear infinite reverse;
}

.maltese-mark,
.maltese-mark-secondary {
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
  transform-origin: 200px 200px;
}

.maltese-mark {
  stroke-width: 1.95;
  stroke-dasharray: 9 10 86 12;
  animation: stroke-shimmer 16s ease-in-out infinite;
}

.maltese-mark-secondary {
  stroke-width: 1.15;
  stroke-dasharray: 4 8 54 11;
  opacity: 0.88;
  animation: stroke-shimmer 19s ease-in-out infinite reverse;
}

.maltese-core-ring {
  fill: none;
  stroke: rgba(212, 162, 78, 0.45);
  stroke-width: 0.8;
  stroke-dasharray: 2 5;
  animation: core-rotate 22s linear infinite;
  transform-origin: 200px 200px;
}

.maltese-core-diamond {
  fill: none;
  stroke: rgba(212, 162, 78, 0.66);
  stroke-width: 0.8;
  opacity: 0.85;
}

.maltese-core-glow {
  opacity: 0.75;
  transform-origin: center;
  transform-box: fill-box;
  animation: core-pulse 7.2s ease-in-out infinite;
}

.maltese-core-dot {
  fill: rgba(212, 162, 78, 0.86);
  opacity: 0.9;
  animation: core-flicker 6.6s ease-in-out infinite;
}

.maltese-spark {
  fill: rgba(212, 162, 78, 0.72);
  transform-origin: 200px 200px;
  animation: spark-drift 14s ease-in-out infinite;
}

.maltese-spark-a { animation-delay: 0s; }
.maltese-spark-b { animation-delay: 3.5s; }
.maltese-spark-c { animation-delay: 7s; }
.maltese-spark-d { animation-delay: 10.5s; }

@keyframes mark-breathe {
  0%, 100% { transform: scale(1.045); opacity: 0.94; }
  50% { transform: scale(1.075); opacity: 1; }
}

@keyframes orbit-drift {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes stroke-shimmer {
  0%, 100% { stroke-dashoffset: 0; opacity: 0.78; }
  50% { stroke-dashoffset: -42; opacity: 1; }
}

@keyframes core-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes core-pulse {
  0%, 100% { transform: scale(0.9); opacity: 0.52; }
  50% { transform: scale(1.14); opacity: 0.84; }
}

@keyframes core-flicker {
  0%, 100% { opacity: 0.72; }
  45% { opacity: 1; }
  60% { opacity: 0.8; }
}

@keyframes spark-drift {
  0%, 100% { opacity: 0.35; transform: rotate(0deg) translateY(0); }
  50% { opacity: 0.92; transform: rotate(3deg) translateY(-2px); }
}

/* --- Projects Section --- */
.projects {
  padding: 2.5rem 3rem 6rem;
  max-width: 760px;
  margin: 0 auto;
}

.section-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.2rem;
  opacity: 0.85;
}

.project-grid {
  display: grid;
  gap: 1rem;
}

.project-card {
  text-decoration: none;
  color: inherit;
  display: block;
  border-radius: 16px;
}

.project-card-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem 1.75rem;
  background:
    linear-gradient(135deg, rgba(33, 48, 72, 0.84) 0%, rgba(20, 29, 43, 0.82) 54%, rgba(15, 24, 38, 0.9) 100%);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 20px 40px rgba(4, 9, 16, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition:
    transform 0.42s var(--ease-standard),
    border-color 0.42s var(--ease-standard),
    box-shadow 0.42s var(--ease-standard),
    background 0.42s var(--ease-standard);
}

.project-card:hover .project-card-inner,
.project-card:focus-visible .project-card-inner {
  background:
    linear-gradient(135deg, rgba(38, 55, 82, 0.9) 0%, rgba(24, 34, 51, 0.88) 55%, rgba(17, 27, 42, 0.94) 100%);
  border-color: var(--card-border-strong);
  box-shadow:
    0 24px 50px rgba(4, 9, 16, 0.42),
    0 10px 30px rgba(197, 48, 48, 0.12),
    0 6px 22px rgba(212, 162, 78, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transform: translateY(-3px);
}

.project-card:focus-visible {
  outline: 2px solid rgba(212, 162, 78, 0.62);
  outline-offset: 0.35rem;
}

.project-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  border: 1px solid rgba(212, 162, 78, 0.2);
  background: linear-gradient(160deg, rgba(212, 162, 78, 0.18), rgba(212, 162, 78, 0.06));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: var(--gold);
  flex-shrink: 0;
}

.project-info {
  flex: 1;
}

.project-info h3 {
  font-family: var(--sans);
  font-weight: 560;
  font-size: 1.06rem;
  margin-bottom: 0.35rem;
  color: var(--text);
  letter-spacing: 0.01em;
}

.project-info p {
  max-width: 48ch;
  font-size: 0.91rem;
  color: var(--text-muted);
  font-weight: 340;
  line-height: 1.58;
}

.project-arrow {
  color: var(--text-muted);
  opacity: 0.45;
  transform: translate(-3px, 3px);
  transition: transform 0.38s var(--ease-standard), color 0.3s ease, opacity 0.3s ease;
}

.project-card:hover .project-arrow,
.project-card:focus-visible .project-arrow {
  opacity: 1;
  transform: translate(0, 0);
  color: var(--gold);
}

/* --- Footer --- */
footer {
  position: relative;
  z-index: 1;
  padding: 2rem 3rem 2.4rem;
  text-align: center;
  font-size: 0.79rem;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  font-weight: 350;
  border-top: 1px solid rgba(212, 162, 78, 0.08);
  background: linear-gradient(180deg, rgba(11, 17, 24, 0), rgba(11, 17, 24, 0.44));
}

.footer-dot {
  margin: 0 0.5rem;
  opacity: 0.3;
}

/* --- Fade In Animations --- */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.9s var(--ease-standard), transform 0.9s var(--ease-standard);
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in-delay-1 { transition-delay: 0.12s; }
.fade-in-delay-2 { transition-delay: 0.24s; }
.fade-in-delay-3 { transition-delay: 0.38s; }

/* --- Responsive --- */
@media (max-width: 900px) {
  nav {
    padding: 1rem 1.4rem;
  }

  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 6.4rem 1.5rem 2rem;
    gap: 0;
  }

  .hero-visual {
    order: 1; /* Graphic stays at the top */
    min-height: 0;
    margin-bottom: -1rem;
  }

  .maltese-container {
    max-width: 140px;
    margin: 0 auto;
  }

  .hero-content {
    padding-left: 0;
    order: 2;
    margin: 0 auto;
    z-index: 2;
  }

  .hero-sub {
    margin-left: auto;
    margin-right: auto;
    max-width: 32ch;
  }

  .projects {
    padding: 1rem 1.5rem 4.8rem;
  }
}

@media (max-width: 480px) {
  .hero-line {
    font-size: 2.65rem;
  }

  .hero-sub {
    font-size: 0.98rem;
    line-height: 1.72;
  }

  .maltese-container {
    max-width: 110px;
  }

  .project-card-inner {
    padding: 1.25rem 1.2rem;
    gap: 1rem;
  }

  .project-info p {
    font-size: 0.9rem;
  }
}

@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;
  }

  .fade-in {
    opacity: 1;
    transform: none;
  }

  .maltese-container {
    transform: none !important;
  }
}
