/* =========================================================
   Phantom UI — Global Stylesheet
   - Responsive, accessible, and balanced with fluid sizing
   - Designed to complement the HTML structure you have
   ========================================================= */

/* -----------------------------
   0) Design tokens
--------------------------------*/
:root {
  /* Brand */
  --brand-1: #6b5bff;
  --brand-2: #5b8dff;
  --brand-3: #7b5cff;

  /* Base */
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-2: #fbfcff;
  --text: #101828;
  --muted: #667085;
  --muted-2: #8a94a6;

  /* Status */
  --up: #0dbb7c;
  --down: #e43d3d;
  --warn: #f59e0b;

  /* Lines & effects */
  --line: #e7ebf3;
  --shadow-1: 0 10px 30px rgba(31, 41, 55, .07);
  --shadow-2: 0 6px 18px rgba(31, 41, 55, .05);

  /* Shape */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;

  /* Sizing scales (fluid) */
  --step--1: clamp(.78rem, .74rem + .2vw, .9rem);
  --step-0:  clamp(.95rem, .9rem + .25vw, 1.05rem);
  --step-1:  clamp(1.05rem, 1rem + .45vw, 1.25rem);
  --step-2:  clamp(1.25rem, 1.1rem + .75vw, 1.55rem);
  --step-3:  clamp(1.6rem,  1.3rem + 1.3vw, 2rem);
  --step-4:  clamp(2rem,    1.5rem + 2vw,   2.6rem);

  /* Layout */
  --container: 1200px;
  --pad: clamp(16px, 2vw, 24px);
}

/* Dark-mode friendly defaults if you decide later
@media (prefers-color-scheme: dark) {
  :root {
    --bg:#0b1220; --surface:#0f172a; --surface-2:#0d1528;
    --text:#e6e9f2; --muted:#94a3b8; --muted-2:#7a889b;
    --line:#1f2a44; --shadow-1:none; --shadow-2:none;
  }
}
*/

/* -----------------------------
   1) Base
--------------------------------*/
*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--step-0) / 1.6 "Inter", system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
}

/* Typography */
h1, h2, h3, h4, h5, h6 { margin: 0 0 .5em; font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: var(--step-4); line-height: 1.15; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }
small.small { font-size: .85em; }
.muted { color: var(--muted); }

/* Helpers */
.container {
  width: min(100% - 2*var(--pad), var(--container));
  margin-inline: auto;
}
.grid { display: grid; gap: 20px; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.link { color: var(--brand-1); text-decoration: none; font-weight: 600; }
.link:hover { text-decoration: underline; }
.icon { margin-right: .5ch; }
.dot { inline-size: .6rem; block-size: .6rem; border-radius: 50%; background: var(--warn); display: inline-block; margin-right: .6rem; }
.brand-gradient { background: linear-gradient(90deg, var(--brand-1), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.is-hidden { display: none !important; }

/* Buttons */
.btn {
  --bgc: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
  gap: .5rem;
  border: 1px solid var(--line);
  background: var(--bgc);
  color: var(--text);
  font-weight: 600; letter-spacing: .01em;
  padding: .65rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none;
  transition: transform .06s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
.btn:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--soft { --bgc: #eef2ff; border-color: #e1e7ff; color: #2b3eff; }
.btn--primary {
  border: 0;
  background: linear-gradient(90deg, var(--brand-1), var(--brand-2));
  color: #fff;
  box-shadow: 0 6px 14px rgba(91, 92, 226, .35);
}
.btn--ghost { background: var(--surface); }

/* Chips / pills */
.chip, .pill {
  display: inline-flex; align-items: center; gap: .45rem;
  border: 1px solid var(--line);
  padding: .45rem .75rem;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600; font-size: .92rem;
}
.chip--action { cursor: pointer; }
.pill { font-size: .9rem; background: var(--surface-2); }
.pill.is-active { background: #edeaff; color: #3c2df0; border-color: #e0ddff; }

/* Icon button */
.icon-btn {
  inline-size: 36px; block-size: 36px;
  display: inline-grid; place-items: center;
  border-radius: var(--radius-xs);
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
}
.icon-btn:hover { box-shadow: var(--shadow-2); }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: .6rem; font-weight: 600; color: var(--muted); }
.switch input[type="checkbox"] { inline-size: 38px; block-size: 22px; appearance: none; background: #dfe4f2; border-radius: 999px; position: relative; outline: none; border: 0; cursor: pointer; }
.switch input[type="checkbox"]::after {
  content: ""; position: absolute; inset: 3px auto auto 3px;
  inline-size: 16px; block-size: 16px; border-radius: 50%; background: #fff; transition: transform .2s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.switch input[type="checkbox"]:checked { background: #cfe1ff; }
.switch input[type="checkbox"]:checked::after { transform: translateX(16px); }

/* -----------------------------
   2) Top strips & header
--------------------------------*/
.strip--risk {
  background: #fff8e6; color: #7a5b0a;
  border-block-end: 1px solid #ffe7b4;
  font-size: .92rem;
}
.strip--risk .container { padding-block: .5rem; display: flex; align-items: center; gap: .6rem; }

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-block-end: 1px solid var(--line);
}
.header__inner {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center; gap: 16px;
  padding-block: .85rem;
}
.brand {
  display: grid; grid-template-columns: 44px 1fr; gap: .7rem; align-items: center; text-decoration: none; color: inherit;
}
.brand__logo {
  inline-size: 44px; block-size: 44px; border-radius: 12px;
  display: grid; place-items: center; color: #fff; font-weight: 800;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  box-shadow: 0 6px 18px rgba(91, 92, 226, .35);
}
.brand__logo--lg { inline-size: 52px; block-size: 52px; border-radius: 14px; }
.brand__text small { display: block; color: var(--muted); font-weight: 500; }

.nav { display: inline-flex; gap: 1rem; justify-self: center; }
.nav a { text-decoration: none; color: var(--text); font-weight: 600; opacity: .9; }
.nav a:hover { opacity: 1; color: #2e36d8; }

.header__cta { display: inline-flex; gap: .6rem; }

.header__menu {
  display: none; border: 0; background: transparent; padding: 4px; cursor: pointer;
}
.header__menu span { display:block; inline-size: 24px; block-size: 2px; background: #111; margin-block: 5px; border-radius: 1px; }

/* -----------------------------
   3) Hero
--------------------------------*/
.hero { padding-block: 3.2rem 2rem; }
.hero__grid { display: grid; grid-template-columns: 1.25fr .9fr; gap: 26px; align-items: start; }
.hero__copy p { margin: .7rem 0 1.1rem; color: var(--muted); }
.hero__actions { display: flex; gap: .65rem; flex-wrap: wrap; }

.stats-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-1);
}
.stats-card h3 { margin-bottom: .25rem; }
.stat-list { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .5rem; }
.stat-list li { display: flex; align-items: center; justify-content: space-between; padding: .5rem .6rem; background: var(--surface-2); border:1px dashed var(--line); border-radius: 10px; }

/* -----------------------------
   4) Featured brokers
--------------------------------*/
.card-section { padding-block: 1rem 2.2rem; }
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem;
  margin-bottom: 1rem;
}
.section-head--split { align-items: center; }
.grid--cards { grid-template-columns: repeat(3, 1fr); }

.broker-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: 1rem;
  display: grid; gap: .75rem;
}
.broker-card__head { display: grid; grid-template-columns: auto 1fr auto; gap: .75rem; align-items: center; }
.broker-card .avatar {
  inline-size: 38px; block-size: 38px; border-radius: 10px; display: grid; place-items: center;
  font-weight: 800; background: #eef2ff; color: #2b3eff;
}
.broker-card__meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.broker-card__meta dt { font-size: .85rem; color: var(--muted); }
.broker-card__meta dd { margin: 0; font-weight: 700; }
.broker-card__foot { display: flex; justify-content: flex-end; }

/* -----------------------------
   5) Across the Market
--------------------------------*/
.market { padding-block: 1.5rem 2.2rem; }
.market .toolbar { display: inline-flex; gap: .8rem; align-items: center; }

.dropdown { position: relative; }
.dropdown .menu {
  position: absolute; inset-block-start: 110%; inset-inline-end: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: .4rem; min-inline-size: 220px; box-shadow: var(--shadow-2);
  display: none;
}
.dropdown:focus-within .menu { display: block; }
.dropdown .menu a { display: block; padding: .6rem .7rem; border-radius: 8px; color: var(--text); text-decoration: none; }
.dropdown .menu a:hover { background: var(--surface-2); }

.market__layout { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }

/* Left column (chip list) */
.pill-nav { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .9rem; }
.chip-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.chip-row {
  display: grid; grid-template-columns: 28px 1fr auto auto; align-items: center; gap: .6rem;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  padding: .5rem .7rem;
  box-shadow: var(--shadow-2);
  cursor: pointer;
}
.chip-row:hover { background: var(--surface-2); }
.chip-row.is-active { border-color: #d9d5ff; background: #f3f2ff; }
.chip-row__icon { inline-size: 24px; block-size: 24px; border-radius: 50%; background: #eef2ff; display: grid; place-items: center; }
.chip-row__name { font-weight: 700; }
.chip-row__price { font-variant-numeric: tabular-nums; font-weight: 700; }
.chip-row__change { font-variant-numeric: tabular-nums; font-weight: 700; justify-self: end; min-inline-size: 70px; text-align: right; }
.chip-row__change[data-dir="up"] { color: var(--up); }
.chip-row__change[data-dir="down"] { color: var(--down); }

/* Right column (chart card) */
.market__card {
  display: grid; gap: .6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: .9rem;
}
.market__header { display: grid; grid-template-columns: 1fr auto; align-items: center; }
.market__title h3 { margin: 0; }
.market__actions { display: inline-flex; gap: .4rem; }
.market__chart {
  inline-size: 100%;
  block-size: clamp(300px, 40vh, 560px); /* Responsive height: phone → desktop */
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfcff, #f7f8ff);
  overflow: hidden;
}
.market__footer {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .6rem;
}
.periods { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 0; }
.periods button {
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  padding: .45rem .8rem; font-weight: 600; cursor: pointer;
}
.periods button.is-active { background: #edeaff; color: #3c2df0; border-color: #e0ddff; }

/* Market table */
.table-wrap {
  margin-top: 1rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-1);
}
.data-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.data-table thead th {
  background: #f3f5fb; color: #3f4453; text-align: left; padding: .8rem .9rem; font-size: .9rem; border-bottom: 1px solid var(--line);
}
.data-table td { padding: .7rem .9rem; border-bottom: 1px solid var(--line); }
.data-table tbody tr:hover { background: #fafbff; }

/* -----------------------------
   6) Economic Calendar
--------------------------------*/
.calendar { padding-block: 1.4rem 2.4rem; }
.calendar__card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: 1rem;
  overflow: hidden;
}
.calendar__card iframe,
.calendar__card [id^="economicCalendarWidget"] {
  inline-size: 100%; min-block-size: 420px;
}

/* -----------------------------
   7) Info cards
--------------------------------*/
.info-cards { padding-block: .8rem 2.8rem; }
.info {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: 1rem 1.1rem;
  display: grid; gap: .6rem; align-content: start;
}
.info__icon {
  inline-size: 48px; block-size: 48px; border-radius: 12px;
  background: #eef2ff; color: #2b3eff; display: grid; place-items: center;
  font-size: 1.4rem; font-weight: 700;
}

/* -----------------------------
   8) Footer
--------------------------------*/
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.grid--footer { grid-template-columns: 2fr 1fr 1fr; gap: 26px; padding-block: 2.2rem; }
.footer__brand { display: grid; align-content: start; gap: .6rem; }
.site-footer nav a { display: block; text-decoration: none; color: var(--muted); padding: .25rem 0; }
.site-footer nav a:hover { color: var(--text); }

/* -----------------------------
   9) Drawer (Watchlist)
--------------------------------*/
.drawer {
  border: 0; padding: 0; margin: 0;
  inline-size: min(480px, 100vw); block-size: 100%;
  position: fixed; inset-block: 0; inset-inline-end: 0;
  border-radius: 0; background: var(--surface);
  display: none;
}
.drawer[open] { display: block; }
.drawer::backdrop { background: rgba(16, 24, 40, .35); backdrop-filter: blur(2px); }
.drawer__head {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px;
  padding: .9rem 1rem; border-bottom: 1px solid var(--line);
}
.drawer__body { padding: 1rem; }
.watchlist { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.watchlist__item {
  display: grid; grid-template-columns: 1fr auto auto auto; gap: .6rem; align-items: center;
  border: 1px solid var(--line); border-radius: 12px; padding: .55rem .7rem; background: var(--surface-2);
}
.watchlist__name { font-weight: 700; }
.watchlist__chg[data-dir="up"] { color: var(--up); }
.watchlist__chg[data-dir="down"] { color: var(--down); }
.watchlist__item .remove { justify-self: end; }

/* -----------------------------
   10) Flags (minimal placeholder styles)
--------------------------------*/
.flag { display: inline-block; border-radius: 50%; }
.flag--eu-us { inline-size: 24px; block-size: 24px; background: linear-gradient(90deg, #1f3fb8 50%, #b22234 50%); position: relative; }
.flag--eu-us::before { content: ""; position: absolute; inset: 0 50% 0 0; background:
  radial-gradient(circle at 60% 50%, #ffd700 2px, transparent 3px),
  radial-gradient(circle at 70% 40%, #ffd700 2px, transparent 3px),
  radial-gradient(circle at 50% 30%, #ffd700 2px, transparent 3px); opacity: .8; }
.flag--gb-us { inline-size: 24px; block-size: 24px; background:
  conic-gradient(from 45deg, #b22234 0 12.5%, #fff 0 25%, #012169 0 37.5%, #fff 0 50%, #b22234 0 62.5%, #fff 0 75%, #012169 0 87.5%, #fff 0); }

/* -----------------------------
   11) Header responsiveness
--------------------------------*/
@media (max-width: 1024px) {
  .header__inner { grid-template-columns: auto 1fr auto auto; }
  .nav { display: none; }
  .header__menu { display: inline-block; }
}

/* -----------------------------
   12) Grid responsiveness
--------------------------------*/
@media (max-width: 1200px) {
  :root { --container: 1100px; }
}
@media (max-width: 1024px) {
  :root { --container: 940px; }
  .hero__grid { grid-template-columns: 1fr; }
  .stats-card { order: 2; }
  .grid--cards { grid-template-columns: repeat(2, 1fr); }
  .grid--footer { grid-template-columns: 1.5fr 1fr 1fr; }
}
@media (max-width: 900px) {
  .market__layout { grid-template-columns: 1fr; }
  .quotes { order: 2; }
  .market__chart { block-size: clamp(280px, 45vh, 520px); }
}
@media (max-width: 720px) {
  :root { --container: 92ch; }
  .grid--cards { grid-template-columns: 1fr; }
  .grid--3 { grid-template-columns: 1fr; }
  .grid--footer { grid-template-columns: 1fr; }
  .chip-row { grid-template-columns: 24px 1fr auto; }
  .chip-row__change { min-inline-size: auto; }
}
@media (max-width: 480px) {
  .btn { padding: .55rem .8rem; }
  .market__footer { grid-template-columns: 1fr; }
  .periods { justify-content: center; }
  .hero { padding-block: 2rem 1rem; }
  .brand__logo { inline-size: 40px; block-size: 40px; }
}

/* -----------------------------
   13) Small enhancements
--------------------------------*/
.noscript {
  margin: 1rem auto;
  max-inline-size: 920px;
  background: #fff4f4; color: #7a2525; border: 1px solid #ffd0d0;
  padding: .9rem 1rem; border-radius: var(--radius-sm);
}

/* Focus ring for a11y */
:where(a, button, [role="button"], .chip, .pill, input, .icon-btn):focus-visible {
  outline: 3px solid #a5b4fc; outline-offset: 2px; border-radius: 10px;
}

/* Menu toggle (optional if you expand mobile nav in JS) */
.menu-open .nav { display: flex; flex-direction: column; gap: .8rem; position: absolute; inset-inline: 0; inset-block-start: 100%; background: var(--surface); border-block-end: 1px solid var(--line); padding: 1rem var(--pad); }

/* Make embedded MQL calendar not cramped on mobile */
.calendar__card { overflow: auto; }
/* --- Guides polish pack --- */
.page.container { padding-bottom: 84px; }
.page-hero { padding-block: 28px 10px; }
.page-hero h1 { margin: 0 0 4px; }
.page-hero p { margin: 0; }

/* sticky toolbar that matches site cards */
.guides-toolbar {
  position: sticky; top: 72px; /* adjust if your header height differs */
  z-index: 5;
  backdrop-filter: saturate(1.2) blur(6px);
  border: 1px solid #e9eef6;
  box-shadow: 0 8px 18px rgba(23,28,45,.05);
}

/* topic chips: horizontal scroll on small screens */
.topics { overflow:auto; scrollbar-width: thin; padding-bottom: 2px; }
.topics::-webkit-scrollbar { height: 8px; }
.topics::-webkit-scrollbar-thumb { background: #e4e9f7; border-radius: 999px; }

/* save button feedback */
.save-btn { transition: background .15s ease, color .15s ease, border-color .15s ease; }
.save-btn.active { color:#b86b00; background:#fff7e8; border-color:#f4d6a6; }

/* cards get a subtle inner line to match homepage */
.card.guide { border-color:#e9eef6; }
.guide__cover { background-size: cover; }
.guide__chips .chip-sm { background:#f5f7fe; border-color:#e8edff; color:#37446a; }
.guide__chips .chip-sm:hover { background:#eef2ff; }
/* ===== Footer polish ===== */

/* Columns */
.site-footer { background:#fbfbfe; border-top:1px solid var(--line); }
.footer-grid{
  display:grid; grid-template-columns: 2.2fr 1fr 1fr;
  gap:28px; padding:28px 0; align-items:flex-start;
}

/* Brand column spacing */
.footer-grid .brand { margin-bottom:8px; }
.footer-grid p { margin:0 0 10px; }

/* Make nav links vertical with breathing room */
.footer-grid nav h4{
  margin:0 0 8px; font-size:14px; color:#0f172a;
}
.footer-grid nav a{
  display:block;                /* stack links */
  margin:4px 0;                 /* vertical rhythm */
  color:#111827; opacity:.92;
  text-decoration:none;
}
.footer-grid nav a:hover{ text-decoration:underline; opacity:1; }

/* Bottom legal row */
.legal{
  border-top:1px solid var(--line);
  padding:12px 0; color:var(--muted);
  display:flex; gap:16px; align-items:center; justify-content:space-between; flex-wrap:wrap;
}

/* Legal links sit on the right, compact & muted */
.legal-links{
  display:flex; gap:10px; align-items:center; flex-wrap:wrap;
  font-size:12px; color:var(--muted);
}
.legal-links a{ color:inherit; text-decoration:none; }
.legal-links a:hover{ text-decoration:underline; }
.legal-links .dot{ opacity:.5; }

/* Mobile: stack columns and keep legal readable */
@media (max-width:900px){ .footer-grid{ grid-template-columns:1fr 1fr; } }
@media (max-width:640px){
  .footer-grid{ grid-template-columns:1fr; }
  .legal{ flex-direction:column; align-items:flex-start; gap:8px; }
}
