/* ============================================================
   Ernesto Marine Electric — underwater theme
   Plain CSS, no build step. Shared across all pages.
   ============================================================ */

:root {
  /* Ocean palette: sunlit surface -> abyss */
  --surface:  #8fe0ef;
  --shallow:  #2bb4cf;
  --ocean:    #0e6e8c;
  --deep:     #063b54;
  --abyss:    #021726;

  /* Accents */
  --aqua:     #3ed0d6;
  --aqua-2:   #6fe9e0;
  --coral:    #ff7a59;   /* warm CTA pop against the blue */
  --coral-2:  #ff6a45;
  --sand:     #f6e8c8;

  /* Text */
  --ink:      #eaf8fc;
  --muted:    #a9cdda;
  --ink-dark: #04222f;

  /* Glass surfaces */
  --glass:        rgba(255, 255, 255, 0.07);
  --glass-strong: rgba(255, 255, 255, 0.11);
  --glass-border: rgba(255, 255, 255, 0.16);

  --maxw: 1140px;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0, 12, 24, 0.45);
  --font-head: "Outfit", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
}

/* ----------------------------- Base ----------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--abyss);
  position: relative;
}

/* The fixed ocean backdrop sits behind everything */
.ocean {
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(143, 224, 239, 0.55) 0%, rgba(43, 180, 207, 0) 45%),
    linear-gradient(180deg, var(--shallow) 0%, var(--ocean) 28%, var(--deep) 62%, var(--abyss) 100%);
}

/* Sun god-rays drifting from the surface */
.rays {
  position: fixed;
  inset: -20% 0 auto 0;
  height: 90vh;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(170deg, rgba(255, 255, 255, 0.20), transparent 60%),
    linear-gradient(195deg, rgba(255, 255, 255, 0.14), transparent 55%),
    linear-gradient(150deg, rgba(255, 255, 255, 0.10), transparent 50%);
  filter: blur(6px);
  transform-origin: top center;
  animation: sway 14s ease-in-out infinite alternate;
  opacity: 0.7;
}

@keyframes sway {
  from { transform: skewX(-6deg) translateX(-2%); opacity: 0.55; }
  to   { transform: skewX(6deg)  translateX(2%);  opacity: 0.85; }
}

/* Rising bubbles layer (filled by ocean.js) */
.bubbles {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.bubble {
  position: absolute;
  bottom: -60px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.85), rgba(255,255,255,0.12) 60%, rgba(255,255,255,0) 70%);
  box-shadow: inset 0 0 6px rgba(255,255,255,0.5);
  animation: rise linear infinite;
  opacity: 0;
}
@keyframes rise {
  0%   { transform: translateY(0) translateX(0) scale(0.6); opacity: 0; }
  10%  { opacity: 0.7; }
  50%  { transform: translateY(-50vh) translateX(18px) scale(1); }
  90%  { opacity: 0.6; }
  100% { transform: translateY(-104vh) translateX(-12px) scale(1.05); opacity: 0; }
}

/* Drifting marlin (injected by ocean.js) */
.marlin {
  position: fixed;
  left: 0; top: 0;
  z-index: -1;
  pointer-events: none;
  width: clamp(140px, 16vw, 215px);
  opacity: 0;
  animation: marlinSwim 24s linear infinite;
  filter: drop-shadow(0 16px 26px rgba(0, 10, 20, 0.5));
}
.marlin svg { display: block; width: 100%; height: auto; transform-origin: 62% 50%; animation: marlinWobble 0.9s ease-in-out infinite; }
@keyframes marlinSwim {
  0%   { transform: translate(-30vw, 16vh) rotate(-5deg); opacity: 0; animation-timing-function: ease-in; }
  6%   { opacity: 0.45; }
  13%  { transform: translate(7vw, 7vh)   rotate(6deg);  animation-timing-function: cubic-bezier(.7, 0, .3, 1); }
  20%  { transform: translate(16vw, 25vh) rotate(-7deg); animation-timing-function: ease-in-out; }
  29%  { transform: translate(30vw, 9vh)  rotate(5deg);  animation-timing-function: cubic-bezier(.7, 0, .3, 1); }
  37%  { transform: translate(38vw, 27vh) rotate(-6deg); animation-timing-function: ease-in-out; }
  46%  { transform: translate(51vw, 11vh) rotate(7deg);  animation-timing-function: cubic-bezier(.7, 0, .3, 1); }
  55%  { transform: translate(60vw, 26vh) rotate(-5deg); animation-timing-function: ease-in-out; }
  64%  { transform: translate(73vw, 8vh)  rotate(6deg);  animation-timing-function: cubic-bezier(.7, 0, .3, 1); }
  73%  { transform: translate(82vw, 25vh) rotate(-6deg); animation-timing-function: ease-in-out; }
  82%  { transform: translate(95vw, 12vh) rotate(5deg);  animation-timing-function: cubic-bezier(.7, 0, .3, 1); }
  93%  { opacity: 0.43; }
  100% { transform: translate(128vw, 18vh) rotate(-3deg); opacity: 0; }
}
@keyframes marlinWobble {
  0%   { transform: rotate(-3.5deg); }
  20%  { transform: rotate(3deg); }
  45%  { transform: rotate(-2.5deg); }
  70%  { transform: rotate(3.5deg); }
  100% { transform: rotate(-3.5deg); }
}

@media (prefers-reduced-motion: reduce) {
  .marlin { display: none !important; }
}

/* --------------------------- Layout ---------------------------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 22px; }

section { position: relative; padding: 96px 0; }
.section-head { max-width: 720px; margin-bottom: 44px; }
.eyebrow {
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--aqua-2);
  margin-bottom: 12px;
}

/* --------------------------- Type ------------------------------ */
h1, h2, h3 { font-family: var(--font-head); line-height: 1.1; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.4rem, 6vw, 4rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin-bottom: 14px; }
h3 { font-size: 1.25rem; margin-bottom: 8px; }
p  { color: var(--muted); }
a  { color: var(--aqua-2); text-decoration: none; }
.lead { font-size: 1.15rem; color: #cfe9f1; }

/* -------------------------- Buttons ---------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-head); font-weight: 600; font-size: 1rem;
  padding: 14px 26px; border-radius: 999px; border: 0; cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--coral), var(--coral-2));
  color: #fff; box-shadow: 0 12px 28px rgba(255, 106, 69, 0.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 36px rgba(255, 106, 69, 0.5); }
.btn-ghost {
  background: var(--glass); color: var(--ink);
  border: 1px solid var(--glass-border); backdrop-filter: blur(8px);
}
.btn-ghost:hover { background: var(--glass-strong); transform: translateY(-2px); }

/* --------------------------- Nav ------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  background: linear-gradient(180deg, rgba(7, 46, 69, 0.94) 0%, rgba(4, 31, 49, 0.88) 100%);
  border-bottom: 1px solid rgba(111, 233, 224, 0.20);
  box-shadow: 0 10px 30px rgba(0, 12, 24, 0.38);
}
.nav .wrap { display: flex; align-items: center; gap: 18px; padding-block: 14px; }
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; color: var(--ink); }
.brand .logo { height: 48px; width: auto; flex: none; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.35)); }
.brand small { display: block; font-size: 0.7rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--aqua-2); }
.nav-links { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.nav-links a {
  color: var(--ink); font-weight: 500; padding: 9px 14px; border-radius: 10px;
  font-size: 0.96rem; transition: background 0.16s ease, color 0.16s ease;
}
.nav-links a:hover { background: var(--glass); }
.nav-links a.active { color: var(--abyss); background: var(--aqua-2); }

/* Language toggle */
.lang-toggle {
  display: inline-flex; border: 1px solid var(--glass-border); border-radius: 999px;
  overflow: hidden; background: var(--glass); margin-left: 6px;
}
.lang-toggle button {
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  font-family: var(--font-head); font-weight: 600; font-size: 0.82rem; padding: 7px 13px;
  transition: background 0.16s ease, color 0.16s ease;
}
.lang-toggle button.active { background: var(--aqua-2); color: var(--abyss); }

/* Mobile nav toggle */
.nav-toggle { display: none; margin-left: auto; background: var(--glass); border: 1px solid var(--glass-border); color: var(--ink); width: 44px; height: 44px; border-radius: 12px; cursor: pointer; font-size: 1.3rem; }

/* --------------------------- Hero ------------------------------ */
.hero { padding: 110px 0 90px; text-align: center; }
.hero .wrap { display: flex; flex-direction: column; align-items: center; }
.hero .hero-logo { width: min(440px, 82vw); height: auto; margin-bottom: 14px; filter: drop-shadow(0 16px 34px rgba(0,0,0,0.5)); animation: bob 6s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
.hero h1 { max-width: 16ch; }
.hero .lead { max-width: 56ch; margin: 18px auto 30px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }

/* ------------------------ Glass cards -------------------------- */
.card {
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 30px; backdrop-filter: blur(12px);
  box-shadow: var(--shadow); transition: transform 0.2s ease, border-color 0.2s ease;
}
.card:hover { transform: translateY(-6px); border-color: rgba(110, 233, 224, 0.5); }
.card .icon {
  width: 54px; height: 54px; display: grid; place-items: center; border-radius: 14px;
  background: linear-gradient(135deg, rgba(62,208,214,0.25), rgba(62,208,214,0.05));
  border: 1px solid var(--glass-border); margin-bottom: 16px; color: var(--aqua-2);
}
.card .icon svg { width: 28px; height: 28px; }

.grid { display: grid; gap: 22px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

/* ----------------------- About / split ------------------------- */
.split { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 40px; align-items: center; }
.split ul { list-style: none; margin-top: 18px; display: grid; gap: 12px; }
.split li { display: flex; gap: 12px; color: #d4ecf3; }
.split li svg { flex: none; width: 22px; height: 22px; color: var(--aqua-2); margin-top: 3px; }

/* --------------------------- Stats ----------------------------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; text-align: center; }
.stat .num { font-family: var(--font-head); font-size: 2.4rem; font-weight: 800; color: var(--aqua-2); }
.stat .label { font-size: 0.9rem; color: var(--muted); }

/* -------------------------- Gallery ---------------------------- */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.gallery figure {
  position: relative; aspect-ratio: 4/3; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--glass-border); box-shadow: var(--shadow);
}
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s ease; }
.gallery figure:hover img { transform: scale(1.07); }
.gallery figcaption {
  position: absolute; inset: auto 0 0 0; padding: 14px 16px; font-size: 0.92rem; color: #fff;
  background: linear-gradient(0deg, rgba(2,23,38,0.85), transparent); font-family: var(--font-head); font-weight: 500;
}
/* Styled placeholder tile (used until real photos are added) */
.ph {
  width: 100%; height: 100%; display: grid; place-items: center; color: rgba(255,255,255,0.6);
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,0.12), transparent 45%),
    linear-gradient(135deg, var(--ocean), var(--deep));
}
.ph svg { width: 46px; height: 46px; opacity: 0.7; }

/* --------------------- Video gallery --------------------------- */
.videos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; max-width: 720px; margin: 30px auto 0; }
.vid {
  position: relative; aspect-ratio: 9/16; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--glass-border); box-shadow: var(--shadow); background: #021726;
}
.vid video { width: 100%; height: 100%; object-fit: cover; display: block; }
.vid figcaption {
  position: absolute; inset: auto 0 0 0; padding: 16px 14px 14px; font-size: 0.9rem; color: #fff;
  background: linear-gradient(0deg, rgba(2,23,38,0.9), transparent); font-family: var(--font-head); font-weight: 500; pointer-events: none;
}

/* --------------------- Framed feature image -------------------- */
.media-frame { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--glass-border); box-shadow: var(--shadow); }
.media-frame img { width: 100%; height: 100%; object-fit: cover; display: block; aspect-ratio: 4/3; }

/* ---------------------------- Form ----------------------------- */
.form-card { max-width: 720px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-family: var(--font-head); font-weight: 500; font-size: 0.92rem; margin-bottom: 7px; color: var(--ink); }
.field .req { color: var(--coral); }
.field input, .field select, .field textarea {
  width: 100%; padding: 13px 15px; border-radius: 12px; font: inherit; color: var(--ink);
  background: rgba(255,255,255,0.06); border: 1px solid var(--glass-border); transition: border-color 0.16s ease, background 0.16s ease;
}
.field textarea { min-height: 130px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: rgba(169,205,218,0.6); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--aqua-2); background: rgba(255,255,255,0.10); }
.field select option { color: #04222f; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.hp { position: absolute; left: -9999px; }
.form-success {
  display: none; background: rgba(62,208,214,0.12); border: 1px solid var(--aqua-2);
  border-radius: var(--radius); padding: 22px; text-align: center;
}
.form-success.show { display: block; }
.form-success svg { width: 48px; height: 48px; color: var(--aqua-2); margin-bottom: 8px; }

/* Contact aside */
.contact-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 30px; align-items: start; }
.contact-info { display: grid; gap: 16px; }
.contact-info .row { display: flex; gap: 14px; align-items: flex-start; }
.contact-info .row svg { flex: none; width: 22px; height: 22px; color: var(--aqua-2); margin-top: 3px; }
.contact-info .row b { font-family: var(--font-head); display: block; color: var(--ink); }

/* --------------------------- Footer ---------------------------- */
.footer { position: relative; background: rgba(2, 16, 28, 0.55); border-top: 1px solid var(--glass-border); padding: 54px 0 34px; backdrop-filter: blur(10px); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 30px; margin-bottom: 30px; }
.footer h4 { font-family: var(--font-head); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--aqua-2); margin-bottom: 14px; }
.footer a { display: block; color: var(--muted); padding: 4px 0; overflow-wrap: anywhere; }
.footer a:hover { color: var(--ink); }
.footer .legal { border-top: 1px solid var(--glass-border); padding-top: 22px; text-align: center; font-size: 0.86rem; color: var(--muted); }

/* ----------------------- Wave divider -------------------------- */
.wave { display: block; width: 100%; height: 70px; }
.wave path { fill: rgba(255,255,255,0.04); }

/* --------------------- CTA banner section ---------------------- */
.cta-band { text-align: center; }
.cta-band .card { padding: 54px 30px; background: linear-gradient(135deg, rgba(14,110,140,0.5), rgba(6,59,84,0.5)); }

/* ------------------------- Reveal anim ------------------------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ------------------------- Responsive -------------------------- */
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .split, .contact-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .gallery { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  section { padding: 68px 0; }
  .grid-3, .grid-2, .gallery, .form-row { grid-template-columns: 1fr; }
  .stat .num { font-size: 1.75rem; }
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch;
    gap: 4px; padding: 14px 22px 20px; margin-left: 0;
    background: rgba(2, 23, 38, 0.96); border-bottom: 1px solid var(--glass-border);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 14px; }
  .lang-toggle { margin: 6px 0 0; align-self: flex-start; }
}

/* --------------------- Reduced motion -------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
