/* ==========================================================
   Sea Quest: site styles
   1. Variables (light theme)
   2. Dark mode overrides
   3. Base / layout
   4. Header, navigation, footer
   5. Components
   6. Shared layout (sticky nav, buttons, footer columns)
   ========================================================== */

/* 1. VARIABLES ------------------------------------------- */
:root {
  /* Backgrounds */
  --color-bg: #FAF7F0;              /* main page background (logo cream) */
  --color-bg-alt: #DDF1F2;          /* soft section backgrounds (light aqua) */
  --color-bg-dark: #0F5C6E;         /* header, footer, dark sections (deep teal) */
  --color-card: #FFFFFF;            /* product cards */

  /* Text */
  --color-text: #1F2430;            /* body text */
  --color-text-muted: #5B6270;      /* captions, secondary info */
  --color-text-on-dark: #FAF7F0;    /* text on teal/dark backgrounds */
  --color-heading: #0F5C6E;         /* h1, h2, h3 */

  /* Buttons and links */
  --color-button: #E0585F;          /* primary button (logo coral) */
  --color-button-hover: #D14650;
  --color-button-text: #FFFFFF;
  --color-link: #0F5C6E;
  --color-link-hover: #E0585F;

  /* Accents */
  --color-accent: #F5C518;          /* badges, highlights, current nav item */
  --color-accent-text: #1F2430;     /* text on yellow, never white */
  --color-focus: #E0585F;           /* keyboard focus outline */

  /* Borders */
  --color-border: #D9DCE0;
  --color-border-on-dark: rgba(250, 247, 240, 0.2);
  --color-divider: #9AA0A6;         /* silver, from the logo swoosh */

  /* Stock status */
  --color-in-stock: #2E9E7E;
  --color-low-stock: #F5C518;
  --color-out-of-stock: #9AA0A6;
  --color-error: #B3261E;

  /* Fonts */
  --font-heading: 'Playfair Display', 'Noto Serif SC', 'Songti SC', SimSun, serif;
  --font-body: 'Inter', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;

  /* Layout */
  --max-width: 72rem;               /* content width */
  --space: 1rem;                    /* base spacing unit */

  color-scheme: light dark;         /* native controls follow the theme */
}

/* 2. DARK MODE ------------------------------------------- */
/* Visitor chose dark with the theme button (sets data-theme on <html>) */
:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #111827;
  --color-bg-alt: #172033;
  --color-bg-dark: #0B3F4C;       /* deeper teal for header/footer */
  --color-card: #1B2436;

  --color-text: #F3F4F6;
  --color-text-muted: #9CA3AF;
  --color-heading: #8FD3DE;       /* light teal; the dark teal is unreadable on dark */

  --color-link: #8FD3DE;
  --color-link-hover: #F5C518;
  --color-focus: #F5C518;

  --color-border: #374151;
}

/* Auto: follow the device, unless the visitor chose light.
   Keep these values identical to the data-theme="dark" block above. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #111827;
    --color-bg-alt: #172033;
    --color-bg-dark: #0B3F4C;       /* deeper teal for header/footer */
    --color-card: #1B2436;

    --color-text: #F3F4F6;
    --color-text-muted: #9CA3AF;
    --color-heading: #8FD3DE;       /* light teal; the dark teal is unreadable on dark */

    --color-link: #8FD3DE;
    --color-link-hover: #F5C518;
    --color-focus: #F5C518;

    --color-border: #374151;
  }
}

/* 3. BASE / LAYOUT --------------------------------------- */
body {
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding: calc(var(--space) * 2) var(--space);
}

h1, h2, h3 {
  font-family: var(--font-heading);
  color: var(--color-heading);
  line-height: 1.2;
  margin-bottom: var(--space);
}

p + p {
  margin-top: var(--space);
}

a {
  color: var(--color-link);
}

a:hover {
  color: var(--color-link-hover);
}

a:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* 4. HEADER, NAVIGATION, FOOTER -------------------------- */
header {
  background: var(--color-bg-dark);
  color: var(--color-text-on-dark);
  border-bottom: 1px solid var(--color-border-on-dark);
}

header nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space);
  max-width: var(--max-width);
  margin-inline: auto;
  padding: var(--space);
}

header nav a {
  color: var(--color-text-on-dark);
  text-decoration: none;
}

header nav a:hover,
header nav a:focus-visible {
  color: var(--color-accent);
  outline-color: var(--color-accent);
}

header nav a[aria-current="page"] {
  color: var(--color-accent);
  font-weight: 600;
}

footer {
  background: var(--color-bg-dark);
  color: var(--color-text-on-dark);
  border-top: 1px solid var(--color-border-on-dark);
  padding: var(--space);
  text-align: center;
  font-size: 0.875rem;
}

footer a {
  color: var(--color-text-on-dark);
}

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

/* 5. COMPONENTS ------------------------------------------ */
.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
}

.btn-primary {
  background: var(--color-button);
  color: var(--color-button-text);
}

.btn-primary:hover {
  background: var(--color-button-hover);
}

.badge {
  background: var(--color-accent);
  color: var(--color-accent-text);
}

.muted {
  color: var(--color-text-muted);
}

.price {
  font-variant-numeric: tabular-nums;
}

.species-name {
  font-style: italic;
}

/* Italic Chinese characters look wrong, so italics are switched off */
html[lang^="zh"] .species-name {
  font-style: normal;
}

.stock-in  { color: var(--color-in-stock); }
.stock-low { color: var(--color-low-stock); }
.stock-out { color: var(--color-out-of-stock); }

/* 6. SHARED LAYOUT AND COMPONENTS (used on every page) ---- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;       
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

[hidden] {
  display: none !important;         
}

main > section {
  padding-block: calc(var(--space) * 3);
}

.section-title {
  text-align: center;
}

.photo {
  width: 100%;
  border-radius: 0.5rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.6em 1.2em;
  border: 0;
  border-radius: 0.5rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

/* Sticky nav */
/* Default (about, gallery, contact): stays at the top of the page while scrolling */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header nav {
  align-items: center;
  justify-content: space-between;
}

.site-header .logo img {
  height: 3.25rem;                  
  width: auto;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space);
  list-style: none;
  padding: 0;
}

/* Footer layout */
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: var(--space);
  max-width: var(--max-width);
  margin-inline: auto;
  padding-bottom: var(--space);
  text-align: left;
}

.footer-grid address {
  font-style: normal;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space);
  margin-block: var(--space);
  list-style: none;
  padding: 0;
}

/* Two-column blocks (hero, about, call to action) */
.split {
  display: grid;
  gap: calc(var(--space) * 2);
  align-items: center;
}

.split__text {
  text-align: center;
}

.split__text .btn,
.split__text a {
  margin-top: var(--space);
}

@media (min-width: 48rem) {
  .split { grid-template-columns: 1fr 1fr; }
}

/* Hides text visually but keeps it for screen readers (form labels) */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Theme and language buttons in the nav */
.theme-toggle,
.lang-toggle {
  padding: 0.4em 0.9em;
  border: 1px solid var(--color-border-on-dark);
  border-radius: 999px;
  background: none;
  color: var(--color-text-on-dark);
  cursor: pointer;
}

.theme-toggle:hover,
.lang-toggle:hover {
  border-color: currentColor;
  color: var(--color-accent);
}

/* Consent Banner - Blocks access until accepted */
.consent-banner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75); /* Dark overlay */
  backdrop-filter: blur(4px);
  z-index: 9999; /* Ensure it sits above everything */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.consent-banner[hidden] {
  display: none !important;
}

.consent-content {
  background: var(--color-bg, #fff);
  color: var(--color-text, #333);
  padding: 2rem;
  border-radius: 0.5rem;
  max-width: 500px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  text-align: center;
}

.consent-content p {
  margin-bottom: 1.5rem;
  line-height: 1.6;
  font-size: 0.95rem;
}

.consent-content a {
  color: var(--color-link, #007bff);
  text-decoration: underline;
}

.consent-buttons {
  display: flex;
  justify-content: center;
}

/* Optional: Prevent background scrolling when banner is open */
body.consent-locked {
  overflow: hidden;
}