/* MAIN LAYOUT */

main {
  padding: 40px 0 60px;
}

/* PAGE HEAD */

.page-head {
  padding: 26px 18px 22px;
  margin-top: 16px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at top left, rgba(240,179,118,0.16) 0, transparent 60%),
    radial-gradient(circle at bottom right, rgba(80,128,255,0.2) 0, transparent 55%),
    rgba(5,7,10,0.96);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.page-head::after {
  content: "";
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at 0 0, rgba(240,179,118,0.12) 0, transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(77,129,255,0.16) 0, transparent 55%);
  opacity: 0.7;
  mix-blend-mode: screen;
  pointer-events: none;
}

.page-head-inner {
  position: relative;
  z-index: 1;
}

h1 {
  font-size: clamp(1.9rem, 1.6vw + 1.3rem, 2.3rem);
  margin: 0 0 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.page-sub {
  color: var(--muted);
  margin: 0;
  font-size: 0.94rem;
  max-width: 70ch;
}

/* TABS */

.case-tabs {
  margin: 26px 2px 18px;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(5,7,10,0.9);
  border: 1px solid rgba(255,255,255,0.06);
}

.case-tab {
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition:
    background 0.16s ease,
    color 0.16s ease,
    border-color 0.16s ease,
    transform 0.08s ease;
}

.case-tab span.dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.26);
}

.case-tab.active {
  background: rgba(240,179,118,0.16);
  border-color: rgba(240,179,118,0.5);
  color: var(--text);
  transform: translateY(-1px);
}

.case-tab[data-filter="trading"] span.dot { background: #f0b376; }
.case-tab[data-filter="personal"] span.dot { background: #80a4ff; }
.case-tab[data-filter="business"] span.dot { background: #75d1b8; }

.cases-hint {
  margin: 0 2px 16px;
  font-size: 0.82rem;
  color: var(--muted);
}

/* CASE GRID */

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

.case-card {
  border-radius: var(--radius-lg);
  padding: 12px 13px 11px;
  background:
    radial-gradient(circle at 0 0, rgba(240,179,118,0.12) 0, transparent 60%),
    linear-gradient(145deg, rgba(7,9,13,0.98), rgba(5,7,10,0.98));
  border: 1px solid rgba(255,255,255,0.11);
  box-shadow: 0 14px 34px rgba(0,0,0,0.75);
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition:
    transform 0.16s ease-out,
    box-shadow 0.16s ease-out,
    border-color 0.16s ease-out,
    background 0.16s ease-out;
}

.case-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 48px rgba(0,0,0,0.9);
  border-color: rgba(240,179,118,0.7);
  background:
    radial-gradient(circle at 0 0, rgba(240,179,118,0.18) 0, transparent 62%),
    linear-gradient(145deg, rgba(8,11,18,0.98), rgba(6,9,15,0.98));
}

.case-card small {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.8);
}

.case-card h3 {
  margin: 0;
  font-size: 0.9rem;
}

.case-card-line {
  font-size: 0.8rem;
  color: var(--muted);
}

.case-card-tags {
  margin-top: 3px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.72rem;
}

.case-card-tags span {
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(4,6,10,0.96);
  color: var(--muted);
}

.case-card-pill {
  position: absolute;
  right: 9px;
  top: 10px;
  font-size: 0.7rem;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(0,0,0,0.38);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(245,245,245,0.86);
}

.case-card[data-category="trading"] .case-card-pill { border-color: rgba(240,179,118,0.6); }
.case-card[data-category="personal"] .case-card-pill { border-color: rgba(128,164,255,0.7); }
.case-card[data-category="business"] .case-card-pill { border-color: rgba(117,209,184,0.7); }

/* CTA PANEL */

.cta-panel {
  margin-top: 38px;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.12);
  background:
    radial-gradient(circle at 0 0, rgba(240,179,118,0.18) 0, transparent 50%),
    rgba(7,9,13,0.98);
  box-shadow: var(--shadow-soft);
  padding: 20px 18px 18px;
}

.cta-panel h2 {
  margin: 0 0 10px;
  font-size: 1.18rem;
}

.cta-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.2);
  font-size: 0.84rem;
  background: rgba(5,7,10,0.96);
  color: var(--text);
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.1s ease,
    box-shadow 0.18s ease;
}

.btn:hover {
  background: radial-gradient(circle at 0 0, rgba(240,179,118,0.3) 0, rgba(5,7,10,1) 60%);
  border-color: rgba(240,179,118,0.7);
  box-shadow: 0 12px 30px rgba(0,0,0,0.7);
  transform: translateY(-1px);
}

/* MODAL */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3,5,8,0.82);
  backdrop-filter: blur(16px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
}

.modal-backdrop.active {
  display: flex;
}

.modal {
  max-width: 720px;
  max-height: 100%;
  overflow: auto;
  border-radius: 22px;
  background:
    radial-gradient(circle at top left, rgba(240,179,118,0.16) 0, transparent 60%),
    linear-gradient(145deg, rgba(7,9,13,0.98), rgba(5,7,10,0.98));
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 26px 70px rgba(0,0,0,0.9);
  padding: 18px 18px 16px;
  position: relative;
}

.modal-close {
  position: absolute;
  right: 14px;
  top: 10px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(5,7,10,0.96);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
}

.modal-close:hover {
  background: rgba(240,179,118,0.18);
  color: #fff;
}

.modal-label {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.8);
  margin-bottom: 4px;
}

.modal-title {
  margin: 0 26px 4px 0;
  font-size: 1.08rem;
}

.modal-meta {
  margin: 0 0 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

.modal-tagline {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: var(--muted);
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 10px 18px;
  font-size: 0.86rem;
  color: var(--muted);
  margin-top: 6px;
}

.modal-block h4 {
  margin: 0 0 4px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,0.86);
}

.modal-block p,
.modal-block ul {
  margin: 0 0 6px;
}

.modal-block ul {
  padding-left: 16px;
}

.modal-note {
  margin-top: 6px;
  font-size: 0.76rem;
  color: rgba(180,184,200,0.9);
}

/* LIGHT THEME OVERRIDES — теплий крем + карамель */

html[data-theme="light"] .page-head {
  border-color: rgba(104,82,62,.18);
  background:
    radial-gradient(circle at top left, rgba(245,198,150,.26) 0, transparent 52%),
    radial-gradient(circle at bottom right, rgba(232,165,92,.20) 0, transparent 55%),
    linear-gradient(135deg,#fffdf9 0,#f7efe4 55%,#f2e4d5 100%);
  box-shadow: 0 18px 42px rgba(98,76,56,.14);
}

html[data-theme="light"] .page-sub {
  color:#5f5146;
}

/* TABS */

html[data-theme="light"] .case-tabs {
  background:#fffaf4;
  border-color:rgba(104,82,62,.20);
  box-shadow:0 8px 20px rgba(98,76,56,.10);
}

html[data-theme="light"] .case-tab {
  color:#6d5f53;
}

html[data-theme="light"] .case-tab span.dot {
  background:rgba(104,82,62,.35);
}

html[data-theme="light"] .case-tab.active {
  background:linear-gradient(135deg,#fff5e4,#ffe9cc);
  border-color:rgba(213,128,52,.80);
  color:#2b2119;
}

html[data-theme="light"] .cases-hint {
  color:#7f6f62;
}

/* CASE CARDS */

html[data-theme="light"] .case-card {
  background:linear-gradient(180deg,#fffdf9 0%,#fff7ef 100%);
  border-color:rgba(104,82,62,.18);
  box-shadow:0 16px 40px rgba(98,76,56,.12);
}

html[data-theme="light"] .case-card small {
  color:#7a6b5f;
}

html[data-theme="light"] .case-card h3 {
  color:#2b2119;
}

html[data-theme="light"] .case-card-line {
  color:#5f5146;
}

html[data-theme="light"] .case-card-tags span {
  background:#fffaf4;
  border-color:rgba(104,82,62,.20);
  color:#5f5146;
}

html[data-theme="light"] .case-card-pill {
  background:#fffaf4;
  border-color:rgba(104,82,62,.30);
  color:#2b2119;
}

/* CTA PANEL */

html[data-theme="light"] .cta-panel {
  background:linear-gradient(180deg,#fffdf9 0%,#f8efe4 100%);
  border-color:rgba(104,82,62,.20);
  box-shadow:0 18px 42px rgba(98,76,56,.14);
}

html[data-theme="light"] .cta-panel h2 {
  color:#2b2119;
}

/* BUTTONS */

html[data-theme="light"] .btn {
  background:#fffaf4;
  border-color:rgba(104,82,62,.22);
  color:#2b2119;
  box-shadow:0 8px 18px rgba(98,76,56,.10);
}

html[data-theme="light"] .btn:hover {
  background:#fff2e3;
  border-color:rgba(213,128,52,.60);
  box-shadow:0 12px 26px rgba(216,134,61,.22);
}

/* MODAL */

html[data-theme="light"] .modal {
  background:
    radial-gradient(circle at top left,rgba(245,198,150,.22) 0,transparent 55%),
    linear-gradient(145deg,#fffdf9,#f7efe4);
  border-color:rgba(104,82,62,.24);
  box-shadow:0 26px 70px rgba(98,76,56,.20);
}

html[data-theme="light"] .modal-label {
  color:#7a6b5f;
}

html[data-theme="light"] .modal-title {
  color:#2b2119;
}

html[data-theme="light"] .modal-meta,
html[data-theme="light"] .modal-tagline,
html[data-theme="light"] .modal-grid,
html[data-theme="light"] .modal-note {
  color:#5f5146;
}

html[data-theme="light"] .modal-block h4 {
  color:#2b2119;
}

html[data-theme="light"] .modal-close {
  background:#fffaf4;
  border-color:rgba(104,82,62,.22);
  color:#7a6b5f;
}

html[data-theme="light"] .modal-close:hover {
  background:#fff2e3;
  color:#2b2119;
}

html[data-theme="light"] .modal-backdrop {
  background:rgba(32,24,18,.28);
  backdrop-filter:blur(10px);
}

/* RESPONSIVE */

@media (max-width: 1024px) {
  .case-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .modal-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  main {
    padding: 32px 0 52px;
  }
  .page-head {
    padding: 18px 14px 16px;
    border-radius: 22px;
  }
  .case-grid {
    grid-template-columns: 1fr;
  }
  .cta-panel {
    padding: 16px 14px 16px;
    border-radius: 20px;
  }
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 40px);
    padding: 16px 14px 14px;
    border-radius: 18px;
  }
}