/* NEXORA final themes
   dark  = Atelier Noir  (ink + warm bronze)
   light = Atelier Day   (parchment + deep navy)
*/

html[data-theme="dark"] {
  --bg: #0d0f12;
  --bg-elev: #161a20;
  --bg-soft: #1c2129;
  --line: rgba(201, 168, 124, 0.22);
  --accent: #c9a87c;
  --accent-bright: #e0c49a;
  --text: #f2efe8;
  --muted: #9aa0ab;
  --ok: #7cbc91;
  --danger: #d17b6c;
  --header-bg: rgba(13, 15, 18, 0.92);
  --btn-bg: #c9a87c;
  --btn-text: #0d0f12;
  --btn-ghost-border: rgba(242, 239, 232, 0.28);
  --bar-track: rgba(255, 255, 255, 0.08);
  --bar-fill: linear-gradient(90deg, #6a5538, var(--accent-bright));
  --glow-a: rgba(201, 168, 124, 0.09);
  --glow-b: rgba(80, 100, 130, 0.08);
  --hero-fade: linear-gradient(90deg, var(--bg) 35%, transparent 70%);
  --engraving: rgba(201, 168, 124, 0.35);
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --display: "Libre Baskerville", Georgia, serif;
  --sans: "Source Sans 3", system-ui, sans-serif;
  --tg: #0d0f12;
}

html[data-theme="light"] {
  --bg: #f3eee5;
  --bg-elev: #faf7f1;
  --bg-soft: #e8e1d4;
  --line: rgba(26, 35, 50, 0.14);
  --accent: #1a2332;
  --accent-bright: #9a6b45;
  --text: #1a2332;
  --muted: #5c6573;
  --ok: #2f6b4f;
  --danger: #a85444;
  --header-bg: rgba(243, 238, 229, 0.94);
  --btn-bg: #1a2332;
  --btn-text: #faf7f1;
  --btn-ghost-border: rgba(26, 35, 50, 0.28);
  --bar-track: rgba(26, 35, 50, 0.1);
  --bar-fill: linear-gradient(90deg, #1a2332, #9a6b45);
  --glow-a: rgba(154, 107, 69, 0.08);
  --glow-b: rgba(26, 35, 50, 0.04);
  --hero-fade: linear-gradient(90deg, var(--bg) 40%, transparent 75%);
  --engraving: rgba(26, 35, 50, 0.22);
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --display: "Libre Baskerville", Georgia, serif;
  --sans: "Source Sans 3", system-ui, sans-serif;
  --tg: #f3eee5;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 17px;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

body {
  background:
    radial-gradient(1100px 520px at 8% -10%, var(--glow-a), transparent 55%),
    radial-gradient(800px 420px at 100% 0%, var(--glow-b), transparent 50%),
    var(--bg);
  transition: background 0.35s ease, color 0.25s ease;
}

a { color: var(--accent-bright); text-decoration: none; }
a:hover { opacity: 0.85; }

.wrap { width: min(1140px, calc(100% - 2.2rem)); margin: 0 auto; }

.site-header {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(16px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.65rem 0; gap: 0.65rem; flex-wrap: wrap;
}
.brand {
  font-family: var(--display);
  font-size: 1.35rem;
  letter-spacing: 0.06em;
  color: var(--text);
  font-weight: 700;
}
.brand span { color: var(--accent-bright); }

.nav { display: flex; gap: 0.35rem; flex-wrap: nowrap; align-items: center; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.nav a {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.28rem 0.55rem;
  border: 1.5px solid var(--line);
  background: transparent;
  transition: 0.15s ease;
  white-space: nowrap;
  flex: 0 0 auto;
}
.nav a:hover {
  color: var(--text);
  border-color: var(--accent-bright);
  opacity: 1;
}
.nav a.active {
  color: var(--btn-text);
  background: var(--btn-bg);
  border-color: var(--btn-bg);
}
.nav a.active:hover {
  color: var(--btn-text);
  opacity: 0.92;
}

.controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.lang-switch { display: flex; gap: 0.2rem; flex-wrap: wrap; }
.lang-switch a {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); padding: 0.2rem 0.3rem; border: 1px solid transparent;
}
.lang-switch a.on { border-color: var(--line); color: var(--text); }

.theme-toggle {
  font: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  min-height: 2rem;
}
.theme-toggle:hover { border-color: var(--accent-bright); }

/* Clear primary buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.1rem;
  padding: 0.9rem 1.65rem;
  border: 2px solid var(--btn-bg);
  background: var(--btn-bg);
  color: var(--btn-text);
  font-family: var(--sans);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: 0 1px 0 color-mix(in srgb, var(--text) 12%, transparent);
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--btn-bg) 28%, transparent);
  color: var(--btn-text);
  opacity: 1;
}
.btn:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 2px solid var(--btn-ghost-border);
  box-shadow: none;
}
.btn-ghost:hover {
  border-color: var(--accent-bright);
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  box-shadow: none;
}

.nav .btn {
  min-height: 2.5rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.95rem;
}

/* Hero + portrait */
.hero {
  min-height: auto;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: 1.1rem;
  padding: 1.4rem 0 2rem;
  position: relative;
}
.hero-content { position: relative; z-index: 2; max-width: 36rem; }
.hero-art {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 0;
}
.hero-portrait {
  margin: 0;
  width: min(100%, 380px);
  background: #000;
  overflow: hidden;
  animation: rise 0.8s ease 0.08s both;
}
.hero-portrait img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 52vh;
  object-fit: cover;
  object-position: center center;
}
html[data-theme="light"] .hero-portrait {
  box-shadow: 0 14px 36px rgba(26, 35, 50, 0.16);
}
html[data-theme="dark"] .hero-portrait {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.eyebrow {
  color: var(--accent-bright);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 600;
  margin-bottom: 0.55rem;
  animation: rise 0.8s ease both;
}
.brand-hero {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: 0.02em;
  margin-bottom: 0.55rem;
  color: var(--text);
  animation: rise 0.85s ease 0.05s both;
}
.brand-hero::first-letter { color: var(--accent-bright); }
.hero-line {
  font-family: var(--display);
  font-size: clamp(1.1rem, 2.2vw, 1.45rem);
  font-weight: 400;
  color: var(--text);
  margin-bottom: 0.55rem !important;
  animation: rise 0.85s ease 0.1s both;
}
.hero p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
  max-width: 34rem;
  margin-bottom: 1.2rem;
  animation: rise 0.85s ease 0.14s both;
}
.hero-actions {
  display: flex; gap: 0.65rem; flex-wrap: wrap;
  animation: rise 0.85s ease 0.18s both;
}
.hero-actions .btn {
  min-height: 2.7rem;
  padding: 0.7rem 1.25rem;
  font-size: 0.95rem;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 860px) {
  .header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }
  .brand { font-size: 1.25rem; }
  .nav {
    width: 100%;
    justify-content: space-between;
    gap: 0.28rem;
  }
  .nav a {
    flex: 1 1 0;
    padding: 0.28rem 0.2rem;
    font-size: 0.72rem;
    min-height: 1.9rem;
  }
  .controls { justify-content: space-between; }

  .hero {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 0.75rem 0 1.5rem;
  }
  .hero-art {
    order: -1;
    justify-content: center;
  }
  .hero-portrait {
    width: min(78%, 300px);
  }
  .hero-portrait img {
    max-height: 38vh;
  }
  .brand-hero {
    font-size: clamp(2.2rem, 11vw, 3.2rem);
    margin-bottom: 0.4rem;
  }
  .eyebrow { margin-bottom: 0.4rem; }
  .hero-line { margin-bottom: 0.4rem !important; }
  .hero p { margin-bottom: 0.9rem; font-size: 0.95rem; }
}

.section { padding: 2.8rem 0; }
.section h2 {
  font-family: var(--display);
  font-size: clamp(1.9rem, 3.5vw, 2.55rem);
  font-weight: 700;
  margin-bottom: 0.65rem;
}
.section .lead {
  color: var(--muted);
  margin-bottom: 2.2rem;
  max-width: 38rem;
  font-size: 1.08rem;
}

.feature-rows { display: grid; gap: 0; border-top: 1px solid var(--line); }
.feature-row {
  display: grid;
  grid-template-columns: minmax(11rem, 0.4fr) 1fr;
  gap: 1.5rem;
  padding: 1.7rem 0;
  border-bottom: 1px solid var(--line);
}
.feature-row h3 {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
}
.feature-row p { color: var(--muted); line-height: 1.6; font-size: 1.02rem; }
@media (max-width: 700px) {
  .feature-row { grid-template-columns: 1fr; gap: 0.4rem; }
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.2rem;
}
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: 1fr; }
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  padding: 1.6rem;
}
.card h3 {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.card p { color: var(--muted); line-height: 1.55; font-size: 1rem; }

.pkg-rate {
  font-family: var(--mono);
  font-size: 2.2rem;
  font-weight: 500;
  color: var(--accent-bright);
  margin: 0.85rem 0 0.35rem;
}
.pkg-meta { color: var(--muted); font-size: 0.95rem; margin-bottom: 1.2rem; }

.form-card {
  max-width: 460px;
  margin: 3rem auto;
  padding: 2.1rem;
  border: 1px solid var(--line);
  background: var(--bg-elev);
}
.form-card h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.85rem;
  margin-bottom: 1.4rem;
}
label { display: block; color: var(--muted); font-size: 0.88rem; margin: 1rem 0 0.4rem; font-weight: 500; }
input, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.9rem 0.95rem;
  font: inherit;
  font-size: 1.02rem;
  min-height: 3rem;
}
input:focus, select:focus { outline: 2px solid var(--accent-bright); outline-offset: 1px; }
.form-error {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  color: var(--danger);
  padding: 0.8rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}
.form-actions { margin-top: 1.5rem; display: flex; gap: 0.75rem; flex-wrap: wrap; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
@media (max-width: 700px) { .stats { grid-template-columns: 1fr; } }
.stat {
  border: 1px solid var(--line);
  padding: 1.3rem;
  background: var(--bg-elev);
}
.stat-btn {
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.stat-btn:hover, .stat-btn:focus-visible {
  border-color: var(--accent-bright);
  outline: none;
}
.stat-hint {
  margin-top: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.stat .label { color: var(--muted); font-size: 0.88rem; margin-bottom: 0.45rem; }
.stat .value {
  font-family: var(--mono);
  font-size: 1.55rem;
  font-weight: 500;
  color: var(--accent-bright);
}

.deposit-box {
  border: 1px solid var(--line);
  padding: 1.35rem;
  background: var(--bg-soft);
  margin-bottom: 2rem;
}
.deposit-box code {
  display: block;
  word-break: break-all;
  margin: 0.65rem 0;
  color: var(--accent-bright);
  font-family: var(--mono);
  font-size: 0.9rem;
}

.position {
  border: 1px solid var(--line);
  padding: 1.4rem;
  margin-bottom: 1rem;
  background: var(--bg-elev);
}
.position-top {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 0.9rem;
}
.position h3 { font-family: var(--display); font-weight: 700; font-size: 1.3rem; }
.ticker {
  font-family: var(--mono);
  font-size: 1.55rem;
  font-weight: 500;
  color: var(--accent-bright);
}
.bar {
  height: 3px;
  background: var(--bar-track);
  margin: 0.85rem 0;
  overflow: hidden;
}
.bar > i {
  display: block; height: 100%; width: 0%;
  background: var(--bar-fill);
  transition: width 0.8s ease;
}
.meta-row {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  color: var(--muted); font-size: 0.92rem;
}

.calc-box {
  margin-top: 3.5rem;
  padding: 1.9rem;
  border: 1px solid var(--line);
  background: var(--bg-elev);
}
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.4rem;
}
@media (max-width: 700px) {
  .calc-grid { grid-template-columns: 1fr; }
}
.calc-results {
  display: grid;
  gap: 0.7rem;
  border-top: 1px solid var(--line);
  padding-top: 1.15rem;
}
.calc-results > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 1rem;
}
.calc-results b {
  color: var(--text);
  font-family: var(--mono);
  font-weight: 500;
}
.calc-net b {
  color: var(--accent-bright);
  font-size: 1.2rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 2.2rem 0 3rem;
  margin-top: 3rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.admin-table th, .admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 0.45rem;
  text-align: left;
}
.admin-table th { color: var(--muted); font-weight: 500; }
.admin-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.admin-actions button {
  font: inherit; font-size: 0.82rem; padding: 0.45rem 0.65rem;
  background: var(--bg); border: 1px solid var(--line); color: var(--text); cursor: pointer;
  min-height: 2.2rem;
}
.admin-actions button:hover { border-color: var(--accent-bright); color: var(--accent-bright); }

.sheet {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  padding: 0;
  width: min(520px, 94vw);
  max-height: min(78vh, 640px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sheet::backdrop {
  background: color-mix(in srgb, #000 55%, transparent);
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.2rem;
  border-bottom: 1px solid var(--line);
}
.sheet-head h3 {
  font-family: var(--display);
  font-size: 1.25rem;
  margin: 0;
}
.sheet-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
}
.sheet-close:hover { color: var(--text); }
.sheet-empty {
  padding: 1.4rem 1.2rem 1.6rem;
  color: var(--muted);
  margin: 0;
}
.tx-list {
  list-style: none;
  margin: 0;
  padding: 0.4rem 0 0.8rem;
  overflow: auto;
}
.tx-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  padding: 0.85rem 1.2rem;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.tx-label { font-size: 0.98rem; }
.tx-when { color: var(--muted); font-size: 0.78rem; margin-top: 0.2rem; }
.tx-amt {
  font-family: var(--mono);
  font-size: 0.95rem;
  white-space: nowrap;
  color: var(--accent-bright);
}
.tx-buy_package .tx-amt { color: var(--muted); }
.tx-package_payout .tx-amt { color: var(--text); }
