/* ---------- Themes (light) ---------- */
/* The active theme is set on <html data-theme="..."> by theme.js
   and rotates every 5 visits. Marine is the starting theme. */

:root,
[data-theme="marine"] {
  --bg: #f0f8fb;
  --bg-soft: #dceef5;
  --card: #ffffff;
  --text: #12374a;
  --muted: #5b7a8a;
  --accent: #0077b6;
  --accent-2: #009d9d;
  --wave-1: #dceef5;
  --wave-2: #0077b6;
}

[data-theme="sunset"] {
  --bg: #fff7f0;
  --bg-soft: #ffe8d6;
  --card: #ffffff;
  --text: #4a2512;
  --muted: #a0715a;
  --accent: #e76f51;
  --accent-2: #e63946;
  --wave-1: #ffe8d6;
  --wave-2: #e76f51;
}

[data-theme="forest"] {
  --bg: #f3faf3;
  --bg-soft: #e0f0e0;
  --card: #ffffff;
  --text: #1e3b26;
  --muted: #6a8a72;
  --accent: #2d6a4f;
  --accent-2: #52b788;
  --wave-1: #e0f0e0;
  --wave-2: #2d6a4f;
}

[data-theme="violet"] {
  --bg: #faf5ff;
  --bg-soft: #ede4f7;
  --card: #ffffff;
  --text: #32204a;
  --muted: #7d6a99;
  --accent: #7c3aed;
  --accent-2: #d6409f;
  --wave-1: #ede4f7;
  --wave-2: #7c3aed;
}

[data-theme="ember"] {
  --bg: #faf6f1;
  --bg-soft: #f0e6d8;
  --card: #ffffff;
  --text: #3d2f1f;
  --muted: #8a7a64;
  --accent: #d97706;
  --accent-2: #dc2626;
  --wave-1: #f0e6d8;
  --wave-2: #d97706;
}

/* ---------- Base ---------- */

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

html { scroll-behavior: smooth; }

body {
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.6s ease, color 0.6s ease;
}

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

main {
  flex: 1;
  width: min(64rem, 94vw);
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

h1 { font-size: 2.4rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.5rem; margin: 2.2rem 0 0.9rem; color: var(--accent); }
p + p { margin-top: 0.75rem; }

.lede { color: var(--muted); font-size: 1.1rem; max-width: 44rem; }

/* ---------- Nav ---------- */

nav {
  background: var(--card);
  padding: 0.9rem 4vw;
  display: flex;
  align-items: center;
  gap: 1.4rem;
  flex-wrap: wrap;
  border-bottom: 3px solid var(--accent);
  box-shadow: 0 1px 8px rgba(20, 60, 80, 0.08);
}

nav .brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
}

nav a { text-decoration: none; color: var(--muted); font-weight: 500; }
nav a:hover, nav a[aria-current="page"] { color: var(--accent); }

/* ---------- Hero (landing) ---------- */

.hero-photo {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  min-height: 26rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background:
    linear-gradient(to top, rgba(4, 34, 52, 0.82) 0%, rgba(4, 34, 52, 0.25) 45%, rgba(4, 34, 52, 0.05) 70%),
    url("img/humpback-underwater.jpg") center / cover no-repeat;
  color: #f2fbff;
  padding: 3rem clamp(1.2rem, 4vw, 3rem) 2.4rem;
  box-shadow: 0 10px 30px rgba(10, 50, 70, 0.25);
}

.hero-photo h1 { font-size: clamp(2rem, 5vw, 3.2rem); color: #ffffff; }
.hero-photo .lede { color: #cfe8f3; }
.hero-photo .photo-credit {
  position: absolute;
  top: 0.7rem;
  right: 1rem;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.75);
}
.hero-photo .photo-credit a { color: rgba(255, 255, 255, 0.85); }

.hero-photo .actions { margin-top: 1.6rem; display: flex; gap: 0.8rem; flex-wrap: wrap; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #ffffff;
  padding: 0.6rem 1.3rem;
  border-radius: 2rem;
  text-decoration: none;
  font-weight: 700;
}
.btn:hover { background: var(--accent-2); color: #ffffff; }
.btn.ghost { background: rgba(255, 255, 255, 0.12); color: #ffffff; border: 2px solid rgba(255, 255, 255, 0.85); }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.25); }

.waves { display: block; width: 100%; height: 6rem; margin-top: 1rem; }

/* ---------- Cards / lists ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.card {
  background: var(--card);
  border-radius: 0.75rem;
  padding: 1.2rem 1.3rem;
  border: 1px solid var(--bg-soft);
  box-shadow: 0 2px 10px rgba(20, 60, 80, 0.06);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.card:hover { transform: translateY(-3px); border-color: var(--accent); }
.card h3 { margin-bottom: 0.35rem; }
.card p { color: var(--muted); font-size: 0.95rem; }
.card a { text-decoration: none; font-weight: 600; }

ul.plain { list-style: none; }
ul.plain li { padding: 0.4rem 0; border-bottom: 1px solid var(--bg-soft); }

/* ---------- Creature gallery ---------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1.1rem;
  margin-top: 1.5rem;
}

.creature {
  background: var(--card);
  border-radius: 0.8rem;
  overflow: hidden;
  border: 1px solid var(--bg-soft);
  box-shadow: 0 2px 12px rgba(20, 60, 80, 0.08);
  transition: transform 0.15s ease;
}

.creature:hover { transform: translateY(-4px); }

.creature img {
  width: 100%;
  height: 13rem;
  object-fit: cover;
  display: block;
}

.creature.tall img { height: 17rem; }

.creature figcaption { padding: 0.8rem 1rem 1rem; font-size: 0.95rem; }
.creature figcaption strong { display: block; font-size: 1.02rem; }
.creature figcaption .blurb { color: var(--muted); font-size: 0.88rem; }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-radius: 1rem;
  padding: 0.1rem 0.6rem;
  margin: 0.25rem 0 0.35rem;
}
.badge.critical { background: #fde3e3; color: #b42318; }
.badge.endangered { background: #fdeed3; color: #b54708; }
.badge.mystery { background: #e3ecfd; color: #175cd3; }
.badge.recovering { background: #e3fdea; color: #157f3d; }

/* ---------- Footer ---------- */

footer {
  background: var(--bg-soft);
  color: var(--muted);
  text-align: center;
  padding: 1rem;
  font-size: 0.85rem;
}

footer .theme-badge { color: var(--accent); font-weight: 600; }
footer a { color: var(--accent); }

/* ---------- CV ---------- */

.cv-entry { margin-bottom: 1.2rem; }
.cv-entry .when { color: var(--muted); font-size: 0.9rem; }

/* ---------- Edit mode ---------- */

#edit-btn {
  position: fixed;
  bottom: 1.2rem;
  right: 1.2rem;
  z-index: 1000;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 2rem;
  padding: 0.65rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(20, 60, 80, 0.3);
}
#edit-btn:hover { background: var(--accent-2); }

body.editing [data-editable] {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
  cursor: text;
}
body.editing [data-editable]:hover { outline-color: var(--accent-2); }

#edit-hint {
  position: fixed;
  bottom: 1.35rem;
  right: 9.5rem;
  z-index: 1000;
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--bg-soft);
  border-radius: 2rem;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  box-shadow: 0 4px 14px rgba(20, 60, 80, 0.15);
}

/* ---------- Music toggle ---------- */

#music-btn {
  position: fixed;
  bottom: 1.2rem;
  left: 1.2rem;
  z-index: 1000;
  background: var(--card);
  color: var(--text);
  border: 2px solid var(--accent);
  border-radius: 2rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(20, 60, 80, 0.2);
}
#music-btn:hover { border-color: var(--accent-2); color: var(--accent); }

/* ---------- Cursor fish ---------- */

#cursor-fish {
  position: fixed;
  left: 0;
  top: 0;
  font-size: 1.7rem;
  pointer-events: none;
  z-index: 998;
  will-change: transform;
  filter: drop-shadow(0 2px 3px rgba(20, 60, 80, 0.25));
}

/* ---------- Chaos ---------- */

.chaos-btn {
  font-size: 1.2rem;
  padding: 0.8rem 1.6rem;
  border: none;
  border-radius: 0.6rem;
  background: var(--accent-2);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.chaos-btn:hover { transform: rotate(-2deg) scale(1.05); }
.wobble { display: inline-block; animation: wobble 1.6s ease-in-out infinite; }
@keyframes wobble {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}
.floaty {
  position: fixed;
  font-size: 2rem;
  pointer-events: none;
  animation: floatUp 3s linear forwards;
  z-index: 999;
}
@keyframes floatUp {
  to { transform: translateY(-110vh) rotate(720deg); opacity: 0; }
}
