/*
 * Layout foundation
 * --------------------------------------------------
 */
:root {
  --header-offset: 6rem;
  --card-radius: 1rem;
  --canvas-shadow: 0 1.25rem 3rem -1.5rem rgba(33, 37, 41, 0.25);
  --section-gap: 2.5rem;
}

@media (max-width: 767.98px) and (orientation: portrait) {
  :root {
    --header-offset: 6rem;
    --section-gap: 1.75rem;
  }
}

@media (max-width: 991.98px) and (orientation: landscape) {
  :root {
    --header-offset: 5.5rem;
    --section-gap: 2rem;
  }
}

@media (min-width: 992px) {
  :root {
    --header-offset: 6rem;
  }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: #1f2933;
}

.bg-subtle {
  background: radial-gradient(circle at top right, #fefbf4 0%, #f4f3f0 35%, #ebeff5 100%);
  min-height: 100vh;
}

.tracking-wide {
  letter-spacing: 0.1em;
}

.app-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
}

.app-main {
  padding-top: calc(var(--header-offset) + 0.5rem);
  padding-bottom: 0.5rem;
}

.navbar .nav-link {
  color: rgba(31, 41, 51, 0.75);
  letter-spacing: 0.08em;
  transition: color 0.2s ease;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus,
.navbar .nav-link.active {
  color: #1f2933;
}

.app-nav-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem;
  background: #f7f7f5;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  box-shadow: 0 0.5rem 1.25rem -1rem rgba(15, 23, 42, 0.2);
}

.nav-switch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-decoration: none;
  color: #1f2933;
  background: #ffffff;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.nav-switch-btn:hover,
.nav-switch-btn:focus {
  color: #111827;
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 0.5rem 1rem -0.75rem rgba(15, 23, 42, 0.25);
}

.nav-switch-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, #111827, #1f2933);
  border-color: #111827;
  box-shadow: 0 0.75rem 1.5rem -1rem rgba(17, 24, 39, 0.35);
}

.nav-switch-btn.disabled {
  cursor: not-allowed;
  color: rgba(17, 24, 39, 0.35);
  background: #f4f4f2;
  border-color: rgba(17, 24, 39, 0.08);
  box-shadow: none;
}

.ticker-strip {
  background: linear-gradient(90deg, rgba(248, 249, 252, 0.8), rgba(244, 239, 233, 0.8));
}

.ticker-toggle-btn {
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.coin-grid {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.2) transparent;
}

.coin-grid::-webkit-scrollbar {
  height: 0.4rem;
}

.coin-grid::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.2);
  border-radius: 999px;
}

.coin-card {
  min-width: 160px;
  background: #ffffff;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  box-shadow: 0 0.75rem 1.5rem -1.25rem rgba(15, 23, 42, 0.6);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.coin-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 1.5rem 2.5rem -1.75rem rgba(15, 23, 42, 0.45);
}

.coin-symbol {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.coin-name {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.coin-price {
  font-size: 1.1rem;
}

.coin-change {
  font-size: 0.85rem;
}

@media (min-width: 992px) {
  .coin-grid {
    overflow: visible;
    flex-wrap: wrap;
  }

  .coin-card {
    flex: 1 1 calc(10% - 0.9rem);
    max-width: calc(10% - 0.9rem);
    min-width: 120px;
  }
}

@media (max-width: 991.98px) {
  .ticker-strip {
    position: sticky;
    top: 0;
    z-index: 1030;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    border-bottom-color: transparent !important;
  }

  .ticker-strip.is-expanded {
    max-height: 28rem;
    box-shadow: 0 1.5rem 2.5rem -1.25rem rgba(15, 23, 42, 0.45);
  }

  .ticker-strip .container-fluid {
    transition: padding 0.2s ease;
  }

  .ticker-strip:not(.is-expanded) .container-fluid {
    padding-top: 0;
    padding-bottom: 0;
  }

  .coin-grid {
    flex-wrap: wrap;
    overflow: visible;
    gap: 0.75rem;
  }

  .coin-card {
    flex: 1 1 calc(50% - 0.75rem);
    min-width: 0;
    padding: 0.6rem 0.75rem;
  }
}

@media (max-width: 575.98px) {
  .coin-card {
    flex-basis: 100%;
  }
}

@media (orientation: landscape) and (max-width: 991.98px) {
  .ticker-strip.is-expanded {
    max-height: 18rem;
  }

  .ticker-strip {
    transition: max-height 0.3s ease, opacity 0.2s ease;
  }

  .ticker-strip.ticker-hidden {
    max-height: 0 !important;
    opacity: 0;
    border-bottom-color: transparent !important;
  }

  .ticker-strip.ticker-hidden .container-fluid {
    padding-top: 0;
    padding-bottom: 0;
  }

  .coin-card {
    padding: 0.5rem 0.6rem;
  }

  .coin-price {
    font-size: 1rem;
  }

  .coin-change {
    font-size: 0.75rem;
  }
}

.chart-panel {
  margin-bottom: var(--section-gap);
}

.panel-wrapper {
  background: #ffffff;
  border-radius: var(--card-radius);
  border: 1px solid rgba(33, 37, 41, 0.1);
  box-shadow: var(--canvas-shadow);
  overflow: hidden;
}

.panel-header {
  padding: 1.5rem 1.75rem 1rem;
  border-bottom: 1px solid rgba(33, 37, 41, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0.35));
}

.panel-title {
  letter-spacing: 0.2em;
}

.panel-body {
  padding: 1.5rem 1.75rem 1.75rem;
}

#stock-chart-panel .panel-header {
  row-gap: 0.5rem;
}

.portfolio-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.45rem;
  align-items: center;
}

.portfolio-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #f3f6fb;
  border: 1px solid rgba(15, 23, 42, 0.1);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #0f172a;
  line-height: 1.15;
}

@media (max-width: 575.98px) {
  .portfolio-chip {
    font-size: 0.9rem;
    padding: 0.2rem 0.5rem;
  }
}

.index-panel-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.index-chart-block {
  flex: 1 1 auto;
}

.index-highlights-card {
  background: #f8fafc;
  border: 1px solid rgba(33, 37, 41, 0.08);
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  min-width: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.index-highlights-card ul {
  margin-bottom: 0;
}

.index-highlights-card li:last-child {
  border-bottom: none;
}

.index-chart {
  width: 100%;
  height: 420px;
}

@media (min-width: 1200px) {
  .index-chart {
    height: 520px;
  }
}

.chart-meta {
  border-top: 1px solid rgba(33, 37, 41, 0.08);
  padding-top: 0.75rem;
}

.info-section {
  margin-bottom: var(--section-gap);
}

.info-card {
  background: #ffffff;
  border-radius: var(--card-radius);
  border: 1px dashed rgba(33, 37, 41, 0.15);
  padding: 1.5rem 1.75rem;
  box-shadow: 0 1rem 2.5rem -1.75rem rgba(15, 23, 42, 0.35);
}

.info-card li:last-child {
  border-bottom: none;
}

@media (orientation: landscape) {
  .index-panel-layout {
    flex-direction: row;
    align-items: stretch;
  }

  .index-highlights-card {
    flex: 0 0 260px;
    order: -1;
    align-self: stretch;
  }
}

@media (min-width: 992px) {
  .index-panel-layout {
    flex-direction: row;
  }

  .index-highlights-card {
    flex: 0 0 320px;
    order: -1;
  }
}

.site-footer {
  background: #0b1324;
  border-top: 1px solid rgba(248, 249, 250, 0.08);
}

.site-footer a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
}

.site-footer a:hover {
  color: #ffffff;
}
