/* ==========================================================================
   Tyo Tjuan | Market Maker
   Light-gold dominant theme with animated dark-gold gradient accents.
   ========================================================================== */

:root {
  /* -- Palette -- */
  --gold-50:  #FBF6E7;   /* dominant light-gold background */
  --gold-100: #F5EAC8;
  --gold-150: #EFDFAF;
  --surface:  #FFFDF6;   /* card surface, warm white */
  --surface-2:#FFFCEF;
  --ink:      #241A0C;   /* near-black warm brown for text */
  --ink-soft: #6C5A38;
  --ink-faint:#9C8A63;
  --line:     rgba(139, 105, 20, 0.18);
  --line-strong: rgba(139, 105, 20, 0.32);

  --gold-a: #FFE58A;  /* bright highlight */
  --gold-b: #E8C158;  /* mid */
  --gold-c: #C79A2E;  /* classic gold */
  --gold-d: #8B6914;  /* deep antique gold */
  --gold-e: #5C4409;  /* darkest, near-bronze-black */

  --success-bg: #EEF6E9;
  --success-fg: #3C6B2A;
  --success-line: #BFDDAE;
  --error-bg: #FBEBEA;
  --error-fg: #93332B;
  --error-line: #EBBBB6;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 26px;
  --shadow-soft: 0 10px 30px -14px rgba(92, 68, 9, 0.28);
  --shadow-lift: 0 20px 48px -20px rgba(92, 68, 9, 0.38);

  --font-display: 'Playfair Display', 'Georgia', serif;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Space Mono', 'SFMono-Regular', Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(255, 229, 138, 0.55), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(199, 154, 46, 0.22), transparent 55%),
    var(--gold-50);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

a { color: var(--gold-d); }
code { font-family: var(--font-mono); }

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

/* -------------------------------------------------------------------- */
/* Buttons & form fields                                                 */
/* -------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-gold {
  color: #2B1E05;
  background: linear-gradient(120deg, var(--gold-a), var(--gold-b) 45%, var(--gold-c) 75%, var(--gold-d));
  background-size: 220% 220%;
  box-shadow: var(--shadow-soft);
  animation: gold-flow 7s ease-in-out infinite;
}
.btn-gold:hover { box-shadow: var(--shadow-lift); filter: brightness(1.04); }
.btn-outline-gold {
  color: var(--gold-e);
  background: transparent;
  border-color: var(--line-strong);
}
.btn-outline-gold:hover { background: var(--gold-100); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: progress; }

@keyframes gold-flow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; font-size: 0.88rem; color: var(--ink-soft); font-weight: 600; }
.field input {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus { border-color: var(--gold-c); box-shadow: 0 0 0 4px rgba(199, 154, 46, 0.18); }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.9rem; margin-bottom: 16px; border: 1px solid; }
.alert-success { background: var(--success-bg); color: var(--success-fg); border-color: var(--success-line); }
.alert-error { background: var(--error-bg); color: var(--error-fg); border-color: var(--error-line); }

.link-ghost { color: var(--ink-soft); text-decoration: none; font-size: 0.88rem; font-weight: 600; padding: 8px 12px; border-radius: 999px; transition: background .15s ease, color .15s ease; }
.link-ghost:hover { background: var(--gold-100); color: var(--ink); }
.link-danger:hover { background: var(--error-bg); color: var(--error-fg); }

/* -------------------------------------------------------------------- */
/* Brand / animated logo                                                */
/* -------------------------------------------------------------------- */
.brand-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.brand-svg text {
  font-family: var(--font-display);
  font-weight: 700;
}
.brand-tagline {
  font-family: var(--font-body);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  font-size: 0.68rem;
  color: var(--ink-faint);
}

/* -------------------------------------------------------------------- */
/* Top navigation                                                        */
/* -------------------------------------------------------------------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 24px 0;
}
.site-header-links { display: flex; align-items: center; gap: 6px; }
.parent-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold-e);
  background: linear-gradient(120deg, rgba(255,229,138,0.55), rgba(199,154,46,0.25));
  border: 1px solid var(--line-strong);
  padding: 7px 14px;
  border-radius: 999px;
  text-decoration: none;
}

/* -------------------------------------------------------------------- */
/* Hero                                                                   */
/* -------------------------------------------------------------------- */
.hero {
  max-width: 980px;
  margin: 0 auto;
  padding: 56px 24px 20px;
  text-align: center;
}
.hero-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-d);
  font-weight: 700;
  margin: 22px 0 10px;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.1rem);
  line-height: 1.15;
  margin: 0 0 14px;
  color: var(--ink);
}
.hero-title em {
  font-style: normal;
  background: linear-gradient(120deg, var(--gold-e), var(--gold-c) 40%, var(--gold-b) 70%, var(--gold-e));
  background-size: 220% 220%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gold-flow 8s ease-in-out infinite;
}
.hero-sub {
  font-size: 1.02rem;
  color: var(--ink-soft);
  max-width: 620px;
  margin: 0 auto 34px;
  line-height: 1.6;
}

/* -------------------------------------------------------------------- */
/* Search                                                                 */
/* -------------------------------------------------------------------- */
.search-shell {
  max-width: 760px;
  margin: 0 auto;
  position: relative;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 8px 8px 22px;
  box-shadow: var(--shadow-soft);
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
}
.search-box:focus-within {
  border-color: var(--gold-c);
  box-shadow: 0 0 0 6px rgba(199, 154, 46, 0.16), var(--shadow-lift);
  transform: translateY(-1px);
}
.search-box svg { flex-shrink: 0; color: var(--gold-d); }
.search-box input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--ink);
  padding: 12px 0;
  min-width: 0;
}
.search-box input::placeholder { color: var(--ink-faint); }
.search-clear {
  border: none;
  background: var(--gold-100);
  color: var(--gold-e);
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.search-clear.visible { display: flex; }
.search-btn {
  flex-shrink: 0;
  padding: 12px 24px;
}

.search-hint {
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--ink-faint);
  text-align: center;
}
.search-hint b { color: var(--ink-soft); }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 18px;
}
.filter-select {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

/* -------------------------------------------------------------------- */
/* Stats strip                                                           */
/* -------------------------------------------------------------------- */
.stats-strip {
  max-width: 900px;
  margin: 40px auto 0;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 24px;
}
.stats-strip .chip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 6px;
}
.stats-strip .chip strong { color: var(--ink); font-family: var(--font-mono); }

/* -------------------------------------------------------------------- */
/* Results                                                                */
/* -------------------------------------------------------------------- */
.results-shell {
  max-width: 980px;
  margin: 44px auto 100px;
  padding: 0 24px;
  min-height: 200px;
}

.results-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--ink-soft);
  font-size: 0.88rem;
}
.results-meta strong { color: var(--ink); }

.empty-state, .intro-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-faint);
}
.empty-state svg, .intro-state svg { color: var(--gold-c); opacity: 0.75; margin-bottom: 16px; }
.empty-state h3, .intro-state h3 { font-family: var(--font-display); color: var(--ink-soft); font-size: 1.3rem; margin: 0 0 6px; }
.intro-examples {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 18px;
}
.intro-examples button {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  border: 1px dashed var(--line-strong);
  background: var(--surface);
  color: var(--gold-e);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.intro-examples button:hover { background: var(--gold-100); transform: translateY(-1px); }

.skeleton-card { height: 120px; border-radius: var(--radius-md); background: linear-gradient(100deg, var(--surface) 30%, var(--gold-100) 50%, var(--surface) 70%); background-size: 300% 100%; animation: shimmer 1.3s ease-in-out infinite; margin-bottom: 16px; }
@keyframes shimmer { 0% { background-position: 150% 0; } 100% { background-position: -50% 0; } }

/* Group card ------------------------------------------------------------ */
.group-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  transform: translateY(14px);
  animation: card-in .5s cubic-bezier(.2,.7,.3,1) forwards;
}
@keyframes card-in { to { opacity: 1; transform: translateY(0); } }

.group-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  cursor: pointer;
  user-select: none;
  background: linear-gradient(90deg, var(--surface-2), var(--surface));
}
.group-code {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  color: #2B1E05;
  background: linear-gradient(120deg, var(--gold-a), var(--gold-c));
  padding: 6px 12px;
  border-radius: 8px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.group-titles { flex: 1; min-width: 0; }
.group-issuer { font-family: var(--font-display); font-size: 1.12rem; color: var(--ink); margin: 0; }
.group-sub { font-size: 0.78rem; color: var(--ink-faint); margin-top: 2px; }
.group-sub mark { background: none; color: var(--gold-d); font-weight: 700; }
.group-chevron { flex-shrink: 0; color: var(--gold-d); transition: transform .25s ease; }
.group-card.open .group-chevron { transform: rotate(180deg); }

.group-body { max-height: 0; overflow: hidden; transition: max-height .35s ease; }
.group-card.open .group-body { max-height: 4000px; }

.holdings-table-wrap { overflow-x: auto; }
.holdings-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.holdings-table th {
  text-align: left;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.holdings-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  vertical-align: top;
}
.holdings-table tr:last-child td { border-bottom: none; }
.holdings-table tr:hover td { background: var(--gold-50); }
.investor-name { color: var(--ink); font-weight: 700; }
.investor-name mark { background: var(--gold-a); color: var(--ink); padding: 0 2px; border-radius: 3px; }
.pill { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-soft); white-space: nowrap; }
.pill-l { color: #3C6B2A; border-color: #BFDDAE; background: #F2F8EE; }
.pill-f { color: #7A4A16; border-color: #E9CFA0; background: #FBF1E1; }
.num { font-family: var(--font-mono); text-align: right; white-space: nowrap; }
.rank-cell {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--gold-e);
  text-align: center;
  width: 1%;
  white-space: nowrap;
}
.rank-table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 6px;
}
.pct-cell { font-family: var(--font-mono); font-weight: 700; text-align: right; white-space: nowrap; }
.pct-bar-wrap { position: relative; }
.pct-bar-track { position: absolute; inset: 0; background: var(--gold-100); border-radius: 4px; opacity: 0.5; z-index: 0; }
.pct-bar-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--gold-c), var(--gold-b)); border-radius: 4px; z-index: 1; transform-origin: left; animation: bar-grow .7s cubic-bezier(.2,.7,.3,1) both; }
@keyframes bar-grow { from { transform: scaleX(0); } }
.pct-cell span { position: relative; z-index: 2; padding: 4px 8px; display: inline-block; }

.truncate-note { text-align: center; padding: 14px; font-size: 0.82rem; color: var(--ink-faint); background: var(--gold-50); border-radius: var(--radius-sm); margin-bottom: 18px; }

/* -------------------------------------------------------------------- */
/* Footer                                                                 */
/* -------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 34px 24px 40px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.84rem;
}
.site-footer a { color: var(--gold-e); font-weight: 700; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-disclaimer { max-width: 620px; margin: 10px auto 0; font-size: 0.76rem; line-height: 1.6; }

/* -------------------------------------------------------------------- */
/* Ambient gold particles                                                */
/* -------------------------------------------------------------------- */
.particle-field { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.particle {
  position: absolute;
  bottom: -10px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--gold-a), var(--gold-c));
  opacity: 0.55;
  animation: float-up linear infinite;
}
@keyframes float-up {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  10% { opacity: 0.6; }
  100% { transform: translateY(-110vh) translateX(var(--drift, 30px)); opacity: 0; }
}
.page-shell { position: relative; z-index: 1; }

/* -------------------------------------------------------------------- */
/* Generic entrance animation                                            */
/* -------------------------------------------------------------------- */
.animate-rise { opacity: 0; transform: translateY(16px); animation: rise .6s cubic-bezier(.2,.7,.3,1) forwards; animation-delay: var(--delay, 0s); }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }

/* -------------------------------------------------------------------- */
/* Admin area                                                             */
/* -------------------------------------------------------------------- */
.admin-body { background: var(--gold-50); min-height: 100vh; }
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px 34px;
  box-shadow: var(--shadow-lift);
  text-align: center;
}
.brand-mini { display: flex; justify-content: center; margin-bottom: 18px; }
.auth-kicker { font-size: 0.7rem; letter-spacing: 0.28em; text-transform: uppercase; color: var(--gold-d); font-weight: 700; margin: 0 0 6px; }
.auth-title { font-family: var(--font-display); font-size: 1.7rem; margin: 0 0 8px; }
.auth-sub { color: var(--ink-soft); font-size: 0.88rem; margin: 0 0 24px; line-height: 1.5; }
.auth-form { text-align: left; }
.auth-back { display: inline-block; margin-top: 18px; font-size: 0.84rem; color: var(--ink-faint); text-decoration: none; }
.auth-back:hover { color: var(--gold-d); }

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 980px;
  margin: 0 auto;
  padding: 22px 24px 0;
}
.admin-header-meta { display: flex; align-items: center; gap: 4px; font-size: 0.85rem; color: var(--ink-soft); }
.admin-main { max-width: 780px; margin: 0 auto; padding: 30px 24px 80px; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 30px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-soft);
}
.panel-title { font-family: var(--font-display); font-size: 1.35rem; margin: 0 0 16px; }
.panel-note { font-size: 0.86rem; color: var(--ink-soft); line-height: 1.6; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 8px; }
.stat-tile { background: var(--gold-50); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; text-align: center; }
.stat-value { display: block; font-family: var(--font-mono); font-weight: 700; font-size: 1.25rem; color: var(--ink); }
.stat-label { display: block; font-size: 0.72rem; color: var(--ink-faint); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.04em; }

.upload-form { margin-top: 8px; }
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-md);
  padding: 34px 20px;
  cursor: pointer;
  text-align: center;
  margin-bottom: 18px;
  transition: border-color .2s ease, background .2s ease;
  position: relative;
}
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone-icon { color: var(--gold-c); }
.dropzone-text { font-weight: 700; color: var(--ink-soft); }
.dropzone-sub { font-size: 0.78rem; color: var(--ink-faint); }
.dropzone.is-dragging, .dropzone:hover { border-color: var(--gold-c); background: var(--gold-50); }
.dropzone.has-file { border-style: solid; border-color: var(--gold-c); background: var(--gold-50); }

.history-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.history-table th { text-align: left; font-size: 0.7rem; text-transform: uppercase; color: var(--ink-faint); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.history-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); color: var(--ink-soft); font-family: var(--font-mono); font-size: 0.8rem; }

.admin-footer-note { text-align: center; color: var(--ink-faint); font-size: 0.82rem; }
.admin-footer-note a { color: var(--gold-e); font-weight: 700; text-decoration: none; }

/* -------------------------------------------------------------------- */
/* Responsive                                                             */
/* -------------------------------------------------------------------- */
@media (max-width: 640px) {
  .hero { padding: 40px 18px 12px; }
  .search-box { padding-left: 16px; flex-wrap: nowrap; }
  .search-box input { font-size: 0.95rem; }
  .search-btn { padding: 10px 16px; font-size: 0.85rem; }
  .group-head { padding: 14px 16px; gap: 10px; }
  .group-issuer { font-size: 0.98rem; }
  .holdings-table th, .holdings-table td { padding: 9px 10px; font-size: 0.78rem; }
  .admin-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .panel { padding: 22px 18px; }
}
