:root {
  --nav-height: 72px;
  --ink: #17120e;
  --night: #101923;
  --night-2: #162735;
  --stone: #d8d0bd;
  --paper: #f5f0e6;
  --gold: #c99741;
  --copper: #9f5631;
  --pomegranate: #8d2636;
  --lapis: #1d5265;
  --green: #2f705e;
  --line: rgba(23, 18, 14, 0.14);
  --light-line: rgba(245, 240, 230, 0.22);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  min-width: 320px;
}

body::selection {
  background: var(--gold);
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--nav-height);
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto minmax(230px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 12px clamp(18px, 4vw, 56px);
  color: #fff7e7;
  background: rgba(16, 25, 35, 0.86);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  justify-self: start;
  min-width: 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  padding: 3px;
  border: 1px solid rgba(244, 207, 131, 0.42);
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 225, 160, 0.16), transparent 50%),
    linear-gradient(145deg, rgba(141, 38, 54, 0.62), rgba(16, 25, 35, 0.76));
  border-radius: 8px;
  flex: 0 0 auto;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
  white-space: nowrap;
}

.brand strong {
  font-size: 0.96rem;
}

.brand small {
  color: rgba(255, 247, 231, 0.72);
  margin-top: 2px;
  font-size: 0.74rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}

.main-nav a,
.header-action,
.language-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  padding: 0 14px;
  color: rgba(255, 247, 231, 0.84);
}

.main-nav a:hover,
.header-action:hover,
.language-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff7e7;
}

.header-tools {
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.header-action {
  background: rgba(201, 151, 65, 0.18);
  border: 1px solid rgba(201, 151, 65, 0.44);
  color: #fff7e7;
}

.language-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid rgba(255, 247, 231, 0.18);
  background: rgba(255, 255, 255, 0.07);
}

.language-button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 247, 231, 0.7);
  font-size: 0.78rem;
}

.language-button.is-active {
  background: var(--gold);
  color: var(--ink);
}

.sound-toggle {
  position: fixed;
  inset-inline-end: clamp(14px, 3vw, 28px);
  bottom: clamp(14px, 3vw, 28px);
  z-index: 40;
  width: 54px;
  height: 54px;
  min-height: 54px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 247, 231, 0.24);
  border-radius: 8px;
  background: rgba(16, 25, 35, 0.84);
  color: #fff7e7;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.sound-toggle:hover {
  background: rgba(29, 82, 101, 0.92);
}

.sound-toggle.is-muted {
  background: rgba(141, 38, 54, 0.9);
  color: #fff7e7;
}

.sound-toggle.needs-interaction {
  box-shadow:
    0 0 0 4px rgba(201, 151, 65, 0.22),
    var(--shadow);
  animation: sound-attention 1.8s ease-in-out infinite;
}

.sound-svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.speaker-shape {
  fill: currentColor;
  stroke: none;
}

.speaker-wave,
.speaker-cross {
  transition: opacity 160ms ease;
}

.speaker-cross {
  opacity: 0;
}

.sound-toggle.is-muted .speaker-wave {
  opacity: 0;
}

.sound-toggle.is-muted .speaker-cross {
  opacity: 1;
}

@keyframes sound-attention {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-2px);
  }
}

.hero {
  position: relative;
  isolation: isolate;
  min-height: calc(100svh - var(--nav-height) - 76px);
  display: grid;
  align-items: center;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(9, 14, 19, 0.96) 0%, rgba(15, 22, 28, 0.78) 34%, rgba(11, 17, 22, 0.14) 70%),
    linear-gradient(0deg, rgba(16, 25, 35, 0.92) 0%, rgba(16, 25, 35, 0) 32%),
    url("assets/shahnameh-hero.png") center / cover no-repeat;
  color: #fff7e7;
}

.hero-inner {
  width: min(620px, calc(100% - 36px));
  margin-left: clamp(18px, 6vw, 78px);
  margin-right: auto;
  padding: clamp(46px, 8vw, 90px) 0;
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  color: #fff7e7;
  font-size: clamp(2.6rem, 5vw, 4.85rem);
  line-height: 1.02;
  font-weight: 900;
  max-width: 11ch;
}

.hero-copy {
  margin: 22px 0 0;
  max-width: 580px;
  color: rgba(255, 247, 231, 0.86);
  font-size: clamp(0.98rem, 1.35vw, 1.16rem);
  line-height: 1.72;
}

.alpha-strip {
  margin-top: 28px;
  max-width: 540px;
}

.alpha-strip label {
  display: block;
  margin-bottom: 10px;
  color: rgba(255, 247, 231, 0.8);
  font-size: 0.94rem;
  font-weight: 800;
}

.alpha-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 8px;
  background: rgba(255, 247, 231, 0.1);
  border: 1px solid rgba(255, 247, 231, 0.22);
  border-radius: 8px;
  backdrop-filter: blur(16px);
}

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  outline: none;
}

input[type="email"] {
  direction: ltr;
  text-align: left;
}

input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 151, 65, 0.22);
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  cursor: pointer;
  background: var(--gold);
  color: #17120e;
  font-weight: 900;
}

button:hover {
  filter: brightness(1.04);
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.form-message {
  min-height: 24px;
  margin: 10px 0 0;
  color: var(--gold);
  font-size: 0.88rem;
}

.form-message.is-error {
  color: #ffbd9b;
}

.hero-metrics {
  margin-top: 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-metrics span {
  min-width: 134px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 247, 231, 0.18);
  border-radius: 8px;
  background: rgba(16, 25, 35, 0.56);
}

.hero-metrics strong,
.hero-metrics small {
  display: block;
}

.hero-metrics small {
  margin-top: 4px;
  color: rgba(255, 247, 231, 0.68);
}

.section {
  padding: clamp(58px, 8vw, 110px) clamp(18px, 5vw, 72px);
}

.section-heading {
  width: min(860px, 100%);
  margin-bottom: 32px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.1;
}

.section-heading p:not(.eyebrow) {
  margin: 14px 0 0;
  color: rgba(23, 18, 14, 0.72);
  font-size: 1.02rem;
  line-height: 2;
  max-width: 760px;
}

.account-section {
  background:
    linear-gradient(180deg, #f5f0e6 0%, #e8dfcf 100%);
}

.account-layout {
  display: grid;
  grid-template-columns: minmax(320px, 520px) minmax(280px, 1fr);
  gap: 22px;
  align-items: stretch;
}

.auth-panel,
.profile-panel,
.hero-card,
.timeline li {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 16px 48px rgba(65, 45, 28, 0.08);
}

.auth-panel {
  padding: 18px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
  padding: 6px;
  border-radius: 8px;
  background: rgba(23, 18, 14, 0.07);
}

.tab {
  background: transparent;
  color: rgba(23, 18, 14, 0.72);
}

.tab.is-active {
  background: var(--night);
  color: #fff7e7;
}

.auth-form {
  display: none;
}

.auth-form.is-active {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 8px;
  color: rgba(23, 18, 14, 0.82);
  font-weight: 800;
}

.auth-form input {
  border-color: rgba(23, 18, 14, 0.12);
}

.primary-button {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--pomegranate);
  color: #fff7e7;
}

.profile-panel {
  display: grid;
  gap: 24px;
  padding: clamp(22px, 4vw, 38px);
  background:
    linear-gradient(135deg, rgba(22, 39, 53, 0.96), rgba(29, 82, 101, 0.86)),
    var(--night);
  color: #fff7e7;
}

.profile-panel h3 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 1.05;
}

.profile-panel p {
  margin: 12px 0 0;
  color: rgba(255, 247, 231, 0.72);
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.profile-stats div {
  padding: 14px;
  border: 1px solid var(--light-line);
  border-radius: 8px;
  background: rgba(255, 247, 231, 0.08);
}

.profile-stats dt {
  color: rgba(255, 247, 231, 0.62);
  font-size: 0.78rem;
}

.profile-stats dd {
  margin: 6px 0 0;
  font-weight: 900;
}

.heroes-section {
  background: #1a211f;
  color: #fff7e7;
}

.heroes-section .section-heading p:not(.eyebrow) {
  color: rgba(255, 247, 231, 0.7);
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.hero-card {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(255, 247, 231, 0.08), rgba(255, 247, 231, 0.03)),
    var(--night-2);
  border-color: rgba(255, 247, 231, 0.14);
}

.crest {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(201, 151, 65, 0.5);
  border-radius: 8px;
  color: var(--gold);
  font-weight: 950;
  background: rgba(201, 151, 65, 0.08);
}

.hero-card h3 {
  margin: 28px 0 8px;
  font-size: 1.55rem;
}

.hero-card p {
  margin: 0;
  color: rgba(255, 247, 231, 0.72);
  line-height: 1.9;
}

.hero-card small {
  margin-top: 18px;
  color: var(--gold);
  font-weight: 800;
}

.roadmap-section {
  background: var(--paper);
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.timeline li {
  min-height: 230px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.timeline span {
  color: var(--pomegranate);
  font-size: 0.9rem;
  font-weight: 950;
}

.timeline h3 {
  margin: 32px 0 10px;
  font-size: 1.28rem;
}

.timeline p {
  margin: 0;
  color: rgba(23, 18, 14, 0.7);
  line-height: 1.9;
}

.site-footer {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px clamp(18px, 5vw, 72px);
  background: var(--night);
  color: rgba(255, 247, 231, 0.72);
}

@media (max-width: 940px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .main-nav {
    display: none;
  }

  .header-tools {
    gap: 8px;
  }

  .account-layout,
  .hero-grid,
  .timeline {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  :root {
    --nav-height: 66px;
  }

  .site-header {
    padding: 10px 14px;
    gap: 12px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    padding: 2px;
  }

  .brand strong {
    font-size: 0.82rem;
  }

  .brand small {
    display: none;
  }

  .header-action {
    min-height: 38px;
    padding: 0 10px;
    font-size: 0.86rem;
  }

  .language-switch {
    padding: 3px;
  }

  .language-button {
    min-height: 32px;
    padding: 0 8px;
  }

  .sound-toggle {
    width: 48px;
    height: 48px;
    min-height: 48px;
  }

  .hero {
    min-height: calc(100svh - var(--nav-height) - 44px);
    background:
      linear-gradient(90deg, rgba(9, 14, 19, 0.94) 0%, rgba(15, 22, 28, 0.78) 56%, rgba(11, 17, 22, 0.34) 100%),
      linear-gradient(0deg, rgba(16, 25, 35, 0.96) 0%, rgba(16, 25, 35, 0) 34%),
      url("assets/shahnameh-hero.png") 58% center / cover no-repeat;
  }

  .hero-inner {
    width: calc(100% - 28px);
    margin-left: 14px;
    margin-right: 14px;
    padding: 44px 0;
  }

  .hero h1 {
    font-size: clamp(2.2rem, 11vw, 3.25rem);
  }

  .alpha-controls {
    grid-template-columns: 1fr;
  }

  .hero-metrics,
  .profile-stats {
    grid-template-columns: 1fr;
  }

  .account-layout,
  .hero-grid,
  .timeline {
    grid-template-columns: 1fr;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 430px) {
  .brand strong {
    max-width: 122px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-action {
    padding: 0 8px;
  }
}
