/* =========================================================
   Avishay's Realm: main stylesheet
   ========================================================= */

:root {
  --bg: #0c0a1a;
  --bg-raised: #131029;
  --text: #ece9f7;
  --text-muted: #b3aed0;
  --text-dim: #7f7a9e;
  --accent: #9d7df5;
  --accent-strong: #b9a0ff;
  --accent-glow: rgba(157, 125, 245, 0.35);
  --line: rgba(157, 125, 245, 0.28);
  --border: rgba(255, 255, 255, 0.12);

  --font: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --container: 1360px;
  --gutter: clamp(20px, 4.5vw, 72px);
  --header-h: 66px;
  --radius: 8px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 300;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg, canvas { display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.accent { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 3px; border-radius: 4px; }

/* ---------- Buttons & links ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  background: rgba(157, 125, 245, 0.06);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 400;
  transition: background 0.25s, box-shadow 0.25s, transform 0.25s;
}
.btn:hover {
  background: rgba(157, 125, 245, 0.16);
  box-shadow: 0 0 24px var(--accent-glow);
  transform: translateY(-1px);
}
.btn-icon { width: 18px; height: 18px; fill: var(--accent); }
.btn-icon--line { fill: none; stroke: var(--accent-strong); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Section headings ---------- */

.section-head {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 18px;
}
.section-head h2 {
  font-size: clamp(1.4rem, 1.85vw, 1.7rem);
  font-weight: 400;
  white-space: nowrap;
}
.rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), rgba(157, 125, 245, 0.08));
}
.rule--mobile { display: none; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(12, 10, 26, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo { width: 64px; height: auto; }
.brand-name { font-size: 1.6rem; font-weight: 400; letter-spacing: 0.02em; }

.site-nav { display: flex; align-items: center; gap: 26px; }
.nav-links { display: flex; gap: 8px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  position: relative;
  display: block;
  padding: 20px 17px;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 400;
  transition: color 0.2s;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 10px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transform: scaleX(0);
  transition: transform 0.25s;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.is-active { color: var(--text); }
.nav-links a.is-active::after { transform: scaleX(1); }

.social { display: flex; align-items: center; gap: 18px; }
.site-nav .social { padding-left: 26px; border-left: 1px solid var(--border); height: 26px; }
.social a { color: var(--text-muted); transition: color 0.2s, transform 0.2s; }
.social a:hover { color: var(--accent-strong); transform: translateY(-2px); }
.social svg { width: 23px; height: 23px; fill: currentColor; }

.nav-toggle { display: none; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: clamp(300px, 21vw, 440px);   /* taller only reveals more of the picture below; the image keeps its size */
  display: flex;
  align-items: center;
  overflow: hidden;
  isolation: isolate;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: url("../images/hero-home-1920.webp") 50% -3.4vw / cover no-repeat;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(0deg, var(--bg) 0%, rgba(12, 10, 26, 0) 22%),
    linear-gradient(180deg, rgba(12, 10, 26, 0.5) 0%, rgba(12, 10, 26, 0) 20%),
    /* cool indigo-to-violet veil: softens the studio portrait on the left, keeps the text readable */
    linear-gradient(90deg, rgba(14, 10, 40, 0.92) 0%, rgba(26, 16, 68, 0.8) 22%, rgba(40, 24, 104, 0.64) 34%, rgba(52, 31, 128, 0.36) 48%, rgba(56, 33, 136, 0.08) 62%, rgba(56, 33, 136, 0) 72%);
}

.hero-content { padding-top: 30px; padding-bottom: 40px; padding-left: calc(var(--gutter) + 2vw); }

.hero-title {
  font-size: clamp(2.7rem, 4.6vw, 4.6rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: 0.01em;
}
.hero-tagline {
  margin-top: 8px;
  font-size: clamp(1rem, 1.4vw, 1.4rem);
  font-weight: 400;
  letter-spacing: 0.42em;
  color: var(--text);
}
.hero-intro {
  margin: 26px 0 24px;
  max-width: 34em;
  font-size: clamp(0.95rem, 0.95vw, 1.05rem);
  color: var(--text-muted);
}

.hero .visualizer { height: 44px; }

.visualizer {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 64px;
  z-index: -1;
  pointer-events: none;
}

/* ---------- Featured tracks ---------- */

/* pulled up slightly so it overlaps the bottom fade of the header image */
.featured { position: relative; margin-top: -18px; padding: 0 0 44px; }
.featured .section-head { margin-bottom: 26px; }

.tracks {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px 24px;
}

.track {
  position: relative;
  aspect-ratio: 3.7 / 1;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  isolation: isolate;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
}
/* Artwork */
.track-art {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}
.track::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(0deg, rgba(8, 6, 20, 0.92) 0%, rgba(8, 6, 20, 0.6) 45%, rgba(8, 6, 20, 0.05) 100%);
}
.track:hover { border-color: rgba(157, 125, 245, 0.5); box-shadow: 0 10px 40px rgba(60, 30, 140, 0.35); }
.track:hover .track-art { transform: scale(1.04); }
.track.is-playing { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 10px 40px rgba(90, 50, 200, 0.4); }

.play {
  flex: none;
  position: relative;
  width: 40px;
  height: 40px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: rgba(10, 8, 24, 0.35);
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.play::before {
  /* play triangle */
  content: "";
  position: absolute;
  top: 50%; left: 54%;
  width: 0; height: 0;
  border-style: solid;
  border-width: 7px 0 7px 11.5px;
  border-color: transparent transparent transparent #fff;
  transform: translate(-50%, -50%);
}
.play:hover { background: rgba(157, 125, 245, 0.35); transform: scale(1.06); }
.track.is-playing .play { background: var(--accent); border-color: var(--accent); }
.track.is-playing .play::before {
  /* pause bars */
  left: 50%;
  width: 12px; height: 15px;
  border: 0;
  background: linear-gradient(90deg, #fff 0 35%, transparent 35% 65%, #fff 65% 100%);
}

.track-info { flex: 1; min-width: 0; padding-bottom: 2px; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7); }
.track-title { font-size: 0.98rem; font-weight: 500; line-height: 1.3; }
.track-meta { display: flex; flex-direction: column; font-size: 0.85rem; color: #d6d1ee; }
.track-row { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.track-time { flex: none; font-variant-numeric: tabular-nums; font-size: 0.8rem; }

.progress {
  position: relative;
  flex: 1;
  height: 14px;
  cursor: pointer;
}
.progress::before,
.progress-fill {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  height: 2px;
  transform: translateY(-50%);
  border-radius: 2px;
}
.progress::before { right: 0; background: rgba(255, 255, 255, 0.2); }
.progress-fill { width: 0; background: var(--accent-strong); }

/* ---------- About + Contact ---------- */

.intro-split {
  position: relative;
  padding: 24px 0 80px;
  overflow: hidden;
  isolation: isolate;
}
.split {
  display: grid;
  grid-template-columns: 1.6fr auto 1fr;
  gap: 0 clamp(32px, 5vw, 84px);
}
.split::before {
  /* vertical divider */
  content: "";
  grid-column: 2;
  grid-row: 1;
  width: 1px;
  background: var(--line);
}
.about { grid-column: 1; grid-row: 1; }
.contact { grid-column: 3; grid-row: 1; }
.about p, .contact p {
  max-width: 36em;
  margin-bottom: 22px;
  color: var(--text-muted);
  font-size: 0.98rem;
}
.about .section-head .rule { max-width: 760px; }

.waves {
  position: absolute;
  left: 0; bottom: 0;
  width: 100%;
  height: 70%;
  z-index: -1;
  pointer-events: none;
}

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

.site-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: #0a0816;
}
.footer-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 14px;
}
.copyright { color: var(--text-dim); font-size: 0.85rem; }
.footer-right { display: flex; align-items: center; gap: 32px; }
.divider { width: 1px; height: 28px; background: var(--border); }
.motto { color: var(--accent); font-size: 0.9rem; }

/* ---------- Inner page banner (Music, Contact) ---------- */

.page-hero {
  position: relative;
  min-height: clamp(190px, 13.5vw, 240px);
  display: flex;
  align-items: center;
  overflow: hidden;
  isolation: isolate;
}
/* Banner art: sized by the banner's height (not its width) so the moon and
   castle stay in view on wide screens; the left edge fades into the page. */
.page-hero-art {
  position: absolute;
  z-index: -2;
  right: 0;
  top: -33%;               /* start the view just above the moon */
  height: 300%;            /* show ~1/3 of the image height: moon + castle */
  width: auto;
  max-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 40%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 40%);
  pointer-events: none;
  user-select: none;
}
.page-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, var(--bg) 0%, rgba(12, 10, 26, 0.9) 25%, rgba(12, 10, 26, 0.35) 60%, rgba(12, 10, 26, 0.1) 85%),
    linear-gradient(0deg, var(--bg) 0%, rgba(12, 10, 26, 0) 40%);
}
.page-hero-content { padding-top: 28px; padding-bottom: 52px; padding-left: calc(var(--gutter) + 2vw); }

.page-title {
  font-size: clamp(2.6rem, 4.1vw, 4.1rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: 0.02em;
}
.page-tagline {
  margin-top: 8px;
  font-size: clamp(0.9rem, 1.1vw, 1.12rem);
  letter-spacing: 0.38em;
}
.page-hero .visualizer { height: 44px; }

/* ---------- Line / fill icons (shared) ---------- */
.i-line { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.i-fill { fill: currentColor; }

/* ---------- Player controls (shared: buttons, sliders, volume) ---------- */

.pbtn {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-muted);
  transition: color 0.2s, background 0.2s, transform 0.2s;
}
.pbtn:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.pbtn svg { width: 19px; height: 19px; }

.volume { display: flex; align-items: center; gap: 8px; }
.volume[hidden] { display: none; }
.featured-volume { flex: none; }
.featured-volume .range { width: 110px; }
.i-vol { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-vol .v-spk { fill: currentColor; }
.i-vol .v-x { display: none; }
.volume.is-muted .v-waves { display: none; }
.volume.is-muted .v-x { display: inline; }

/* Range sliders (seek + volume) */
.range {
  --fill: 0%;
  -webkit-appearance: none;
  appearance: none;
  height: 18px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent) var(--fill), rgba(255, 255, 255, 0.16) var(--fill));
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(157, 125, 245, 0.35);
}
.range::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.16); }
.range::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
.range::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(157, 125, 245, 0.35); }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%; bottom: 28px;
  z-index: 100;
  padding: 12px 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(19, 16, 41, 0.95);
  color: var(--text);
  font-size: 0.95rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.3s, transform 0.3s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1200px) {
  .nav-links a { padding-inline: 14px; }
  .site-nav { gap: 20px; }
  .site-nav .social { padding-left: 20px; gap: 16px; }
  .tracks { gap: 20px; }
  .track { aspect-ratio: 3.2 / 1; }
}

/* Tablet & mobile: hamburger menu */
@media (max-width: 960px) {
  :root { --header-h: 62px; }

  .brand-logo { width: 58px; }
  .brand-name { font-size: 1.45rem; }

  .nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    width: 44px; height: 44px;
    padding: 8px;
  }
  .nav-toggle span {
    display: block;
    height: 2.5px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
  }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(9.5px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-9.5px) rotate(-45deg); }

  .site-nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px var(--gutter) 24px;
    background: #0e0c1f;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid var(--line);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
  }
  .site-nav.is-open { opacity: 1; visibility: visible; transform: none; }
  .nav-links { flex-direction: column; gap: 0; }
  .nav-links a { padding: 14px 4px; font-size: 1.15rem; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
  .nav-links a::after { display: none; }
  .nav-links a.is-active { color: var(--accent-strong); }
  .site-nav .social { border-left: 0; padding: 20px 4px 0; height: auto; }

  .tracks { grid-template-columns: 1fr; gap: 12px; }

  /* Wide banner cards on mobile */
  .track {
    aspect-ratio: auto;
    min-height: 108px;
    align-items: center;
    padding: 14px 18px;
  }
  .track::after {
    background: linear-gradient(90deg, rgba(8, 6, 20, 0.75) 0%, rgba(8, 6, 20, 0.3) 60%, rgba(8, 6, 20, 0.1) 100%),
                linear-gradient(0deg, rgba(8, 6, 20, 0.6) 0%, rgba(8, 6, 20, 0) 60%);
  }
  .track-info { align-self: flex-end; padding-left: 18px; border-left: 1px solid rgba(255, 255, 255, 0.3); }
  .track-title { font-size: 1.05rem; }
  .track-meta { font-size: 0.9rem; }
  .track-row { margin-top: 2px; }
  .track-time { font-size: 0.85rem; }
  .progress {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    margin: 0;
    height: 10px;
  }
  .progress::before, .progress-fill { top: auto; bottom: 0; transform: none; border-radius: 0; }
  .progress::before { background: rgba(255, 255, 255, 0.08); }

  .split { grid-template-columns: 1fr; gap: 0; }
  .split::before { display: none; }
  .about, .contact { grid-column: 1; grid-row: auto; }
  .contact { margin-top: 24px; padding-top: 40px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
  .rule--mobile { display: block; }
}

/* Phones */
@media (max-width: 640px) {
  /* Inner page banner */
  .page-hero { min-height: 0; }
  /* Phones: the banner is nearly the image's shape, so a regular "cover" fit shows the moon */
  .page-hero-art { display: none; }
  .page-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background: url("../images/hero-1080.webp") 78% 40% / cover no-repeat;
  }
  .page-hero-content { padding: 28px var(--gutter) 44px; }
  .page-tagline { font-size: 0.78rem; letter-spacing: 0.12em; }

  .brand-logo { width: 52px; }
  .brand-name { font-size: 1.35rem; }

  .hero { min-height: 0; align-items: flex-start; }
  .hero::before { background-image: url("../images/hero-home-mobile.webp"); background-position: 70% 30%; }
  .hero::after {
    background:
      linear-gradient(90deg, rgba(12, 10, 26, 0.88) 0%, rgba(12, 10, 26, 0.55) 55%, rgba(12, 10, 26, 0.1) 100%),
      linear-gradient(0deg, var(--bg) 0%, rgba(12, 10, 26, 0) 25%);
  }
  .hero-content { padding: 32px var(--gutter) 40px; }
  .hero-title { font-size: clamp(3rem, 15vw, 4.2rem); }
  .hero-title .accent { display: block; }
  .hero-tagline { font-size: 1.05rem; letter-spacing: 0.3em; }
  .hero-intro { margin: 22px 0 26px; }
  .visualizer { height: 48px; }
  .waves { height: 180px; }

  .featured { margin-top: 0; padding-top: 8px; }
  .section-head { gap: 16px; }
  .section-head h2 { font-size: 1.55rem; }
  .featured .section-head { gap: 12px; }
  .featured-volume .range { width: 72px; }

  .track { min-height: 100px; padding: 12px 16px; gap: 14px; }
  .play { width: 42px; height: 42px; }

  .about p, .contact p { font-size: 1.1rem; }

  .footer-inner { flex-direction: column-reverse; justify-content: center; padding-block: 24px; }
  .footer-right { flex-direction: column; gap: 14px; }
  .footer-right .social { gap: 28px; }
  .footer-right .divider { display: none; }
  .motto { white-space: nowrap; }
  .copyright { display: none; }
}

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