:root {
  --bg: #f5efe4;
  --bg-top: #fbf7f0;
  --bg-bottom: #efe4d1;
  --bg-glow-1: rgba(255, 255, 255, 0.9);
  --bg-glow-2: rgba(227, 207, 173, 0.7);
  --surface: rgba(255, 251, 245, 0.84);
  --surface-strong: #fffdf8;
  --ink: #201a15;
  --muted: #6f6254;
  --line: rgba(54, 40, 26, 0.12);
  --accent: #bf5a2a;
  --accent-strong: #93401a;
  --badge-bg: rgba(191, 90, 42, 0.12);
  --link-tile: #f3eadc;
  --glass-line: rgba(255, 255, 255, 0.6);
  --header-top: rgba(255, 255, 255, 0.8);
  --header-bottom: rgba(255, 248, 239, 0.66);
  --header-tint-1: rgba(191, 90, 42, 0.12);
  --header-tint-2: rgba(227, 207, 173, 0.08);
  --intro-top: rgba(255, 253, 248, 0.9);
  --intro-bottom: rgba(247, 238, 226, 0.92);
  --details-top: rgba(250, 242, 229, 0.95);
  --details-bottom: rgba(255, 251, 245, 0.92);
  --highlight-line: rgba(191, 90, 42, 0.12);
  --highlight-bg: rgba(255, 255, 255, 0.64);
  --thumb-bg: rgba(255, 255, 255, 0.74);
  --accent-outline: rgba(191, 90, 42, 0.35);
  --header-overlay: rgba(32, 26, 21, 0.68);
  --modal-bg: rgba(255, 251, 245, 0.96);
  --modal-media-bg: #efe2cd;
  --modal-close-bg: rgba(32, 26, 21, 0.8);
  --shadow: 0 24px 70px rgba(62, 45, 25, 0.12);
}

* {
  box-sizing: border-box;
}

[x-cloak] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Avenir Next", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, var(--bg-glow-1), transparent 28%),
    radial-gradient(circle at top right, var(--bg-glow-2), transparent 30%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 56%, var(--bg-bottom) 100%);
}

body.theme-sand,
.profile.theme-sand {
  --bg: #f5efe4;
  --bg-top: #fbf7f0;
  --bg-bottom: #efe4d1;
  --bg-glow-1: rgba(255, 255, 255, 0.9);
  --bg-glow-2: rgba(227, 207, 173, 0.7);
  --surface: rgba(255, 251, 245, 0.84);
  --surface-strong: #fffdf8;
  --ink: #201a15;
  --muted: #6f6254;
  --line: rgba(54, 40, 26, 0.12);
  --accent: #bf5a2a;
  --accent-strong: #93401a;
  --badge-bg: rgba(191, 90, 42, 0.12);
  --link-tile: #f3eadc;
  --glass-line: rgba(255, 255, 255, 0.6);
  --header-top: rgba(255, 255, 255, 0.8);
  --header-bottom: rgba(255, 248, 239, 0.66);
  --header-tint-1: rgba(191, 90, 42, 0.12);
  --header-tint-2: rgba(227, 207, 173, 0.08);
  --intro-top: rgba(255, 253, 248, 0.9);
  --intro-bottom: rgba(247, 238, 226, 0.92);
  --details-top: rgba(250, 242, 229, 0.95);
  --details-bottom: rgba(255, 251, 245, 0.92);
  --highlight-line: rgba(191, 90, 42, 0.12);
  --highlight-bg: rgba(255, 255, 255, 0.64);
  --thumb-bg: rgba(255, 255, 255, 0.74);
  --accent-outline: rgba(191, 90, 42, 0.35);
  --header-overlay: rgba(32, 26, 21, 0.68);
  --modal-bg: rgba(255, 251, 245, 0.96);
  --modal-media-bg: #efe2cd;
  --modal-close-bg: rgba(32, 26, 21, 0.8);
  --shadow: 0 24px 70px rgba(62, 45, 25, 0.12);
}

body.theme-coastal,
.profile.theme-coastal {
  --bg: #dce9ef;
  --bg-top: #f2f9fc;
  --bg-bottom: #c3d7e0;
  --bg-glow-1: rgba(255, 255, 255, 0.82);
  --bg-glow-2: rgba(104, 161, 190, 0.42);
  --surface: rgba(234, 245, 250, 0.9);
  --surface-strong: #f7fcff;
  --ink: #13242f;
  --muted: #4f6674;
  --line: rgba(19, 36, 47, 0.12);
  --accent: #2d7ea3;
  --accent-strong: #155c7a;
  --badge-bg: rgba(45, 126, 163, 0.18);
  --link-tile: #cbe7f3;
  --glass-line: rgba(255, 255, 255, 0.54);
  --header-top: rgba(245, 252, 255, 0.88);
  --header-bottom: rgba(219, 240, 250, 0.78);
  --header-tint-1: rgba(45, 126, 163, 0.2);
  --header-tint-2: rgba(104, 161, 190, 0.18);
  --intro-top: rgba(244, 251, 254, 0.96);
  --intro-bottom: rgba(214, 235, 244, 0.98);
  --details-top: rgba(229, 244, 250, 0.98);
  --details-bottom: rgba(243, 251, 254, 0.96);
  --highlight-line: rgba(45, 126, 163, 0.15);
  --highlight-bg: rgba(255, 255, 255, 0.68);
  --thumb-bg: rgba(239, 249, 253, 0.9);
  --accent-outline: rgba(45, 126, 163, 0.48);
  --header-overlay: rgba(14, 45, 61, 0.7);
  --modal-bg: rgba(246, 251, 253, 0.97);
  --modal-media-bg: #d7e8ef;
  --modal-close-bg: rgba(14, 45, 61, 0.82);
  --shadow: 0 24px 70px rgba(28, 73, 95, 0.14);
}

body.theme-forest,
.profile.theme-forest {
  --bg: #e0e7dd;
  --bg-top: #f4f8f1;
  --bg-bottom: #cdd9c7;
  --bg-glow-1: rgba(255, 255, 255, 0.74);
  --bg-glow-2: rgba(116, 143, 108, 0.34);
  --surface: rgba(238, 246, 234, 0.9);
  --surface-strong: #f8fcf5;
  --ink: #1b2619;
  --muted: #5f715b;
  --line: rgba(27, 38, 25, 0.12);
  --accent: #5e8b57;
  --accent-strong: #3f6839;
  --badge-bg: rgba(94, 139, 87, 0.2);
  --link-tile: #d6e8d0;
  --glass-line: rgba(255, 255, 255, 0.52);
  --header-top: rgba(247, 252, 245, 0.88);
  --header-bottom: rgba(220, 235, 215, 0.8);
  --header-tint-1: rgba(94, 139, 87, 0.2);
  --header-tint-2: rgba(116, 143, 108, 0.18);
  --intro-top: rgba(245, 251, 242, 0.96);
  --intro-bottom: rgba(220, 234, 214, 0.98);
  --details-top: rgba(233, 244, 228, 0.98);
  --details-bottom: rgba(246, 251, 243, 0.96);
  --highlight-line: rgba(94, 139, 87, 0.16);
  --highlight-bg: rgba(255, 255, 255, 0.68);
  --thumb-bg: rgba(241, 248, 238, 0.9);
  --accent-outline: rgba(94, 139, 87, 0.48);
  --header-overlay: rgba(25, 38, 24, 0.7);
  --modal-bg: rgba(248, 251, 247, 0.97);
  --modal-media-bg: #dae7d4;
  --modal-close-bg: rgba(25, 38, 24, 0.82);
  --shadow: 0 24px 70px rgba(41, 58, 38, 0.14);
}

body.theme-midnight,
.profile.theme-midnight {
  --bg: #121925;
  --bg-top: #1a2433;
  --bg-bottom: #0a1018;
  --bg-glow-1: rgba(107, 145, 201, 0.18);
  --bg-glow-2: rgba(38, 81, 158, 0.2);
  --surface: rgba(19, 28, 40, 0.92);
  --surface-strong: rgba(14, 21, 31, 0.98);
  --ink: #edf4ff;
  --muted: #9cb0c9;
  --line: rgba(215, 228, 247, 0.12);
  --accent: #7fb7ff;
  --accent-strong: #b8d7ff;
  --badge-bg: rgba(127, 183, 255, 0.22);
  --link-tile: #17314d;
  --glass-line: rgba(175, 206, 247, 0.24);
  --header-top: rgba(26, 39, 57, 0.92);
  --header-bottom: rgba(10, 18, 28, 0.98);
  --header-tint-1: rgba(127, 183, 255, 0.18);
  --header-tint-2: rgba(43, 79, 126, 0.24);
  --intro-top: rgba(23, 34, 49, 0.96);
  --intro-bottom: rgba(12, 19, 29, 0.98);
  --details-top: rgba(20, 31, 45, 0.98);
  --details-bottom: rgba(12, 18, 27, 0.97);
  --highlight-line: rgba(127, 183, 255, 0.16);
  --highlight-bg: rgba(27, 39, 56, 0.72);
  --thumb-bg: rgba(19, 31, 47, 0.92);
  --accent-outline: rgba(127, 183, 255, 0.55);
  --header-overlay: rgba(7, 11, 18, 0.76);
  --modal-bg: rgba(16, 22, 31, 0.97);
  --modal-media-bg: #162232;
  --modal-close-bg: rgba(8, 12, 18, 0.88);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.profile {
  width: min(1200px, calc(100% - 40px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.profile-header {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: 24px;
  align-items: end;
  padding: 32px;
  margin-bottom: 24px;
  border: 1px solid var(--glass-line);
  border-radius: 28px;
  background:
    linear-gradient(135deg, var(--header-top), var(--header-bottom)),
    linear-gradient(120deg, var(--header-tint-1), var(--header-tint-2));
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.profile-header-copy {
  display: grid;
  gap: 16px;
  align-self: center;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.profile-header h1,
.profile-panel h2,
.link-copy strong {
  margin: 0;
}

.profile-header h1 {
  max-width: 12ch;
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.profile-summary {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--muted);
  max-width: 38rem;
}

.profile-hero-media {
  position: relative;
  margin: 0;
  min-height: 320px;
  overflow: hidden;
  border-radius: 24px;
  box-shadow: 0 22px 48px rgba(44, 34, 22, 0.16);
}

.profile-hero-media img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
}

.profile-hero-media figcaption {
  position: absolute;
  right: 18px;
  bottom: 18px;
  max-width: 18rem;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 16px;
  background: var(--header-overlay);
  color: #f9f4ed;
  font-size: 0.92rem;
  line-height: 1.5;
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.95fr) minmax(320px, 1.3fr) minmax(240px, 0.9fr);
  gap: 20px;
  align-items: start;
}

.profile-panel {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.theme-midnight .profile-header,
.theme-midnight .profile-panel,
.theme-midnight .gallery-modal-card {
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.36);
}

.profile-panel--intro {
  background:
    linear-gradient(180deg, var(--intro-top), var(--intro-bottom)),
    var(--surface);
}

.profile-panel--links {
  background: var(--surface-strong);
}

.profile-panel--details {
  background:
    linear-gradient(180deg, var(--details-top), var(--details-bottom)),
    var(--surface);
}

.profile-panel h2 {
  font-size: 1.8rem;
  line-height: 1.05;
  margin-bottom: 14px;
}

.profile-panel p {
  margin: 0;
  line-height: 1.7;
  color: var(--muted);
}

.profile-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.profile-highlights {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.highlight-card {
  display: grid;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid var(--highlight-line);
  border-radius: 18px;
  background: var(--highlight-bg);
}

.highlight-card strong {
  font-size: 1.8rem;
  line-height: 1;
}

.highlight-card span {
  color: var(--muted);
}

.theme-midnight .highlight-card strong,
.theme-midnight .link-copy strong,
.theme-midnight .gallery-thumb span,
.theme-midnight .gallery-modal-copy h2 {
  color: var(--ink);
}

.panel-heading {
  margin-bottom: 18px;
}

.links {
  display: grid;
  gap: 12px;
}

.link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-strong);
  color: var(--ink);
  text-decoration: none;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.link:hover,
.link:focus-visible {
  border-color: var(--accent-outline);
  box-shadow: 0 18px 40px rgba(62, 45, 25, 0.1);
  transform: translateY(-2px);
}

.link-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--link-tile);
  color: var(--accent-strong);
  font-weight: 700;
}

.link-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.link-copy strong {
  font-size: 1.02rem;
}

.link-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.link-action {
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gallery-intro {
  margin-bottom: 18px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.gallery-thumb {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--thumb-bg);
  cursor: pointer;
  text-align: left;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.gallery-thumb:hover,
.gallery-thumb:focus-visible {
  border-color: var(--accent-outline);
  box-shadow: 0 14px 32px rgba(62, 45, 25, 0.1);
  transform: translateY(-2px);
}

.gallery-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  object-fit: cover;
}

.gallery-thumb span {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
}

.gallery-hint {
  margin-top: 16px;
  font-size: 0.92rem;
}

.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
}

.gallery-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 19, 15, 0.62);
  backdrop-filter: blur(8px);
}

.theme-midnight .gallery-modal-backdrop {
  background: rgba(3, 7, 13, 0.76);
}

.gallery-modal-card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  width: min(960px, 100%);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 28px;
  background: var(--modal-bg);
  box-shadow: 0 28px 80px rgba(19, 14, 10, 0.28);
}

.gallery-modal-media {
  min-height: 420px;
  background: var(--modal-media-bg);
}

.gallery-modal-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-modal-copy {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 32px 28px 28px;
}

.gallery-modal-copy h2 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  line-height: 1;
}

.gallery-modal-copy p {
  margin: 0;
  line-height: 1.7;
  color: var(--muted);
}

.gallery-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  padding: 10px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--modal-close-bg);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: rgba(243, 234, 220, 0.42);
}

.theme-coastal .empty-state {
  background: rgba(219, 240, 250, 0.5);
}

.theme-forest .empty-state {
  background: rgba(220, 234, 214, 0.5);
}

.theme-midnight .empty-state {
  background: rgba(24, 35, 51, 0.62);
}

@media (max-width: 980px) {
  .profile-header,
  .profile-grid,
  .gallery-modal-card {
    grid-template-columns: 1fr;
  }

  .profile-header h1 {
    max-width: none;
  }

  .gallery-modal-media {
    min-height: 320px;
  }
}

@media (max-width: 640px) {
  .profile {
    width: min(100% - 24px, 1200px);
    padding: 20px 0 32px;
  }

  .profile-header,
  .profile-panel {
    padding: 22px;
    border-radius: 22px;
  }

  .profile-hero-media {
    min-height: 240px;
  }

  .profile-hero-media img {
    min-height: 240px;
  }

  .link {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .link-index {
    min-width: 38px;
    height: 38px;
  }

  .gallery-grid {
    grid-template-columns: 1fr 1fr;
  }

  .gallery-modal {
    padding: 12px;
  }

  .gallery-modal-copy {
    padding: 22px;
  }
}
