/* ==========================================================
   Whydah Gally — static site styles
   Dark streaming aesthetic, gold accents, nautical touches.
   No external fonts or services.
   ========================================================== */

:root {
  --bg: #07090d;
  --bg-2: #0b0e14;
  --surface: #0f131a;
  --surface-2: #151a23;
  --line: rgba(255, 255, 255, 0.08);
  --line-gold: rgba(214, 174, 86, 0.35);
  --text: #f3efe6;
  --muted: #a1a7b3;
  --gold: #d6ae56;
  --gold-bright: #ecc977;
  --gold-deep: #a9822f;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.8);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main { flex: 1; outline: none; }

img, svg { display: block; max-width: 100%; }

a { color: var(--gold-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: 0.01em; }

:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
  border-radius: 6px;
}

h1:focus, h1:focus-visible { outline: none; }

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  background: var(--gold);
  color: #130e03;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; text-decoration: none; }

.container { width: min(1120px, 100% - 40px); margin-inline: auto; }
.container.narrow { width: min(820px, 100% - 40px); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 9, 13, 0.72);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  width: min(1120px, 100% - 40px);
  margin-inline: auto;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.brand:hover { text-decoration: none; }
.brand img { border-radius: 8px; }

.site-nav { display: flex; align-items: center; gap: 6px; }
.site-nav a {
  position: relative;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s, background 0.2s;
}
.site-nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--gold-bright); background: rgba(214, 174, 86, 0.1); }

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.nav-toggle .bars,
.nav-toggle .bars::before,
.nav-toggle .bars::after {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.2s, background 0.2s;
}
.nav-toggle .bars { position: relative; }
.nav-toggle .bars::before, .nav-toggle .bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle .bars::before { top: -6px; }
.nav-toggle .bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bars::after { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Views ---------- */
.js .view { display: none; }
.js .view.is-active { display: block; animation: viewIn 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.view-guide { padding: 28px 0 72px; }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* Without JS, stack everything with spacing */
html:not(.js) .view + .view { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 48px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(56px, 10vw, 112px) 20px clamp(120px, 16vw, 180px);
  text-align: center;
  background:
    radial-gradient(900px 420px at 50% 0%, rgba(214, 174, 86, 0.14), transparent 70%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 100%);
}

.hero-glow {
  position: absolute;
  left: 50%;
  top: 38%;
  width: min(620px, 90vw);
  height: min(620px, 90vw);
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(214, 174, 86, 0.2), transparent 62%);
  filter: blur(30px);
  animation: breathe 7s ease-in-out infinite;
  pointer-events: none;
}

.compass {
  position: absolute;
  left: 50%;
  top: 40%;
  width: min(760px, 120vw);
  color: var(--gold);
  opacity: 0.1;
  transform: translate(-50%, -50%);
  animation: spin 160s linear infinite;
  pointer-events: none;
}

.hero-content { position: relative; z-index: 2; }

.hero-logo {
  margin: 0 auto 22px;
  width: clamp(96px, 16vw, 132px);
  height: auto;
  filter: drop-shadow(0 8px 30px rgba(214, 174, 86, 0.35));
  animation: float 6s ease-in-out infinite;
}

.hero h1 {
  font-size: clamp(2.6rem, 8vw, 5rem);
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #fff4d6 0%, var(--gold-bright) 45%, var(--gold-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.tagline {
  margin: 14px auto 0;
  max-width: 36ch;
  text-wrap: balance;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.6vw, 1.4rem);
  letter-spacing: 0.02em;
}

.rope {
  margin: 28px auto 0;
  width: min(260px, 60%);
  height: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.rope::before, .rope::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-gold));
}
.rope::after { transform: scaleX(-1); }
.rope span {
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
  background: var(--gold);
  box-shadow: 0 0 14px rgba(214, 174, 86, 0.7);
}

.waves {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  width: 100%;
  height: clamp(70px, 10vw, 120px);
  z-index: 1;
}
.wave { transform-box: fill-box; }
.w1 { fill: rgba(214, 174, 86, 0.07); animation: drift 14s ease-in-out infinite alternate; }
.w2 { fill: var(--bg); animation: drift 18s ease-in-out infinite alternate-reverse; }

@keyframes breathe { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes drift { from { transform: translateX(-3%); } to { transform: translateX(3%); } }

/* ---------- Cards ---------- */
.cards {
  position: relative;
  z-index: 3;
  margin-top: clamp(-72px, -8vw, -40px);
  padding-bottom: 84px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.card {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 4vw, 44px);
  border-radius: 24px;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), border-color 0.3s, box-shadow 0.3s;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(420px 220px at 100% 0%, rgba(214, 174, 86, 0.14), transparent 70%);
  opacity: 0.6;
  transition: opacity 0.3s;
  pointer-events: none;
}
.card:hover { transform: translateY(-6px); border-color: var(--line-gold); box-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(214, 174, 86, 0.08); }
.card:hover::before { opacity: 1; }

.card > * { position: relative; }

.card-icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: var(--gold-bright);
  background: rgba(214, 174, 86, 0.1);
  border: 1px solid var(--line-gold);
  margin-bottom: 26px;
}

/* Gold pirate ship sits in the same icon box as the music note */
.card-icon img { height: 42px; width: auto; }

.card h2 { font-size: clamp(1.8rem, 3.4vw, 2.3rem); }
.card p { margin: 10px 0 28px; color: var(--muted); font-size: 1.08rem; max-width: 34ch; }
.card > .btn { margin-top: auto; }
.card-actions { margin-top: auto; display: flex; flex-wrap: wrap; gap: 12px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 11px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.97rem;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.25s, background 0.2s, border-color 0.2s, color 0.2s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-gold {
  color: #1a1305;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  box-shadow: 0 8px 24px -10px rgba(214, 174, 86, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-gold:hover { box-shadow: 0 12px 30px -10px rgba(236, 201, 119, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.4); }

.btn-ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--line-gold); background: rgba(214, 174, 86, 0.08); color: var(--gold-bright); }

.btn-copy {
  min-height: 40px;
  padding: 8px 16px;
  font-size: 0.9rem;
  color: var(--gold-bright);
  background: rgba(214, 174, 86, 0.1);
  border-color: var(--line-gold);
  flex-shrink: 0;
}
.btn-copy:hover { background: rgba(214, 174, 86, 0.18); }
.btn-copy.is-copied { color: #0d1a0f; background: #8fd19e; border-color: #8fd19e; }

/* ---------- Guides ---------- */
.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95rem;
  padding: 8px 0;
  margin-bottom: 8px;
}
.back:hover { color: var(--gold-bright); text-decoration: none; }

.guide-head { padding: 8px 0 28px; }
.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.guide-head h1 { font-size: clamp(2rem, 5.4vw, 3.2rem); }
.lede { margin: 14px 0 0; color: var(--muted); font-size: 1.1rem; max-width: 60ch; }

/* Jellyfin guide header with the pirate ship */
.guide-head-ship { display: flex; align-items: center; gap: clamp(20px, 4vw, 40px); }
.guide-head-text { min-width: 0; flex: 1; }
.guide-emblem {
  order: 2;
  flex: 0 0 auto;
  width: clamp(104px, 14vw, 128px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 28px;
  background: rgba(214, 174, 86, 0.1);
  border: 1px solid var(--line-gold);
}
.guide-emblem img {
  height: 62%;
  width: auto;
  animation: bob 6s ease-in-out infinite;
}
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-4px) rotate(1.5deg); } }

/* Steps */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
  display: grid;
  gap: 14px;
}
.steps > li {
  counter-increment: step;
  position: relative;
  display: flex;
  gap: 18px;
  padding: 22px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
}
.steps > li::before {
  content: counter(step);
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--gold-bright);
  background: rgba(214, 174, 86, 0.1);
  border: 1px solid var(--line-gold);
}
.step-body { min-width: 0; flex: 1; }
.step-body h2, .step-body h3 { font-size: 1.28rem; }
.step-body p { margin: 6px 0 0; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.steps.compact > li { padding: 18px; }

/* URL box */
.url-box {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 10px 16px;
  border-radius: var(--radius-sm);
  background: #090c11;
  border: 1px solid var(--line-gold);
}
.url-box code {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--gold-bright);
  user-select: all;
}
.url-box-lg { margin: 0 0 24px; padding: 14px 14px 14px 20px; }
.url-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.url-label { font-size: 0.75rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.url-box-lg code { font-size: 1.05rem; }

.privacy-note {
  margin: 26px 0 0;
  padding: 14px 18px;
  color: var(--muted);
  font-size: 0.92rem;
  border-left: 2px solid var(--gold);
  background: rgba(214, 174, 86, 0.05);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.guide-foot { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Tabs ---------- */
.tablist {
  display: flex;
  gap: 8px;
  padding: 6px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tablist::-webkit-scrollbar { display: none; }
.js .tablist { display: flex; }
html:not(.js) .tablist { display: none; }

.tablist [role="tab"] {
  flex: 1 0 auto;
  min-height: 44px;
  padding: 10px 20px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s, background 0.25s, box-shadow 0.25s;
}
.tablist [role="tab"]:hover { color: var(--text); }
.tablist [role="tab"][aria-selected="true"] {
  color: #1a1305;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  box-shadow: 0 6px 20px -8px rgba(214, 174, 86, 0.8);
}

.tabpanel { outline: none; }
.js .tabpanel[hidden] { display: none; }
.js .tabpanel:not([hidden]) { animation: viewIn 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
html:not(.js) .tabpanel { margin-bottom: 32px; }
.panel-title { font-size: 1.55rem; margin: 6px 0 16px; }
.js .panel-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Device list */
.device-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.device-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: #090c11;
  border: 1px solid var(--line);
}
.device-list span { font-weight: 600; }
.device-list a { font-size: 0.93rem; text-align: right; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-2); padding: 36px 0 44px; }
.footer-inner { display: grid; gap: 18px; justify-items: center; text-align: center; }
.footer-brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 1.1rem; }
.footer-brand img { border-radius: 6px; }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; }
.site-footer nav a { color: var(--muted); font-size: 0.93rem; }
.site-footer nav a:hover { color: var(--gold-bright); }
.copy { margin: 0; color: #6c7280; font-size: 0.85rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 300;
  transform: translate(-50%, 20px);
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line-gold);
  box-shadow: var(--shadow);
  font-size: 0.93rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .header-inner { height: 62px; }
  .nav-toggle { display: inline-flex; }
  .js .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 12px 20px 18px;
    background: rgba(7, 9, 13, 0.97);
    border-bottom: 1px solid var(--line);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s, transform 0.25s, visibility 0.25s;
  }
  .js .site-nav.open { opacity: 1; visibility: visible; transform: none; }
  .site-nav a { padding: 14px 16px; font-size: 1.05rem; border-radius: 12px; }
  html:not(.js) .nav-toggle { display: none; }
  html:not(.js) .header-inner { flex-wrap: wrap; height: auto; padding: 10px 0; }

  .cards { grid-template-columns: 1fr; gap: 18px; padding-bottom: 64px; }
  .card:hover { transform: none; }
  .card-actions .btn { flex: 1 1 100%; }

  .guide-head-ship { flex-direction: column; align-items: flex-start; gap: 14px; }
  .guide-emblem { order: 0; width: 76px; border-radius: 20px; }

  .steps > li { padding: 18px 16px; gap: 14px; }
  .steps > li::before { width: 34px; height: 34px; font-size: 1rem; }

  .url-box { flex-direction: column; align-items: stretch; padding: 14px; }
  .url-box .btn-copy { width: 100%; min-height: 44px; }
  .url-box code { font-size: 0.84rem; overflow-wrap: break-word; word-break: normal; }

  .device-list li { flex-direction: column; align-items: flex-start; gap: 2px; }
  .device-list a { text-align: left; }

  .actions .btn { flex: 1 1 100%; }
  .guide-foot .btn { width: 100%; }
}

@media (max-width: 420px) {
  .container, .container.narrow, .header-inner { width: calc(100% - 32px); }
  .brand { font-size: 1.1rem; }
  .url-box code { font-size: 0.8rem; }
  .url-box-lg code { font-size: 0.88rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
