/* =========================================================
   Engel Research – Unified Design System
   Stately • Minimalist • Financial
   ========================================================= */

:root{
  /* --- Palette (neutral-led, single accent) --- */
  --bg:           #f6f8fb;
  --surface:      #ffffff;
  --surface-2:    #f1f4f9;
  --ink:          #0f172a;
  --ink-soft:     #1e293b;
  --muted:        #64748b;
  --muted-2:      #94a3b8;
  --line:         #e2e8f0;
  --line-soft:    #eef2f7;

  /* Brand accent – kept restrained */
  --accent:       #0f172a;          /* dark slate = primary */
  --accent-ink:   #ffffff;
  --accent-hover: #1e293b;

  /* Financial status */
  --pos:          #15803d;
  --pos-soft:     #f0fdf4;
  --pos-border:   #bbf7d0;
  --neg:          #b91c1c;
  --neg-soft:     #fef2f2;
  --neg-border:   #fecaca;
  --warn:         #b45309;

  /* Premium / VIP accent (subtle gold, used sparingly) */
  --gold:         #b08a3e;
  --gold-soft:    #fbf6e7;
  --gold-border:  #e3d2a0;

  /* --- Typography --- */
  --font:         -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                  "Helvetica Neue", Arial, sans-serif;
  --font-mono:    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Type scale */
  --fs-xs:    11px;
  --fs-sm:    12px;
  --fs-base:  14px;
  --fs-md:    15px;
  --fs-lg:    16px;
  --fs-xl:    18px;
  --fs-2xl:   22px;
  --fs-3xl:   28px;
  --fs-4xl:   34px;

  --fw-regular: 400;
  --fw-medium:  500;
  --fw-semi:    600;
  --fw-bold:    700;

  /* Spacing & radius */
  --r-sm:  4px;
  --r-md:  8px;
  --r-lg:  10px;
  --r-pill:999px;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 2px 8px rgba(15,23,42,.05);

  /* Layout */
  --container: 1120px;
  --container-wide: 1200px;

  /* Legacy aliases (back-compat with existing CSS in index.html) */
  --card: var(--surface);
  --primary: var(--accent);
  --soft: var(--surface-2);
}

*{box-sizing:border-box;}
html,body{min-height:100%;overflow-x:hidden;}
body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family:var(--font);
  font-size:var(--fs-base);
  line-height:1.55;
  /* direction & text-align are inherited from <html dir="..."> on each page.
     Hebrew pages (contact, terms) set dir="rtl" — LTR pages stay LTR. */
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}
a{color:inherit;}

/* =========================================================
   TOP BAR — unified across all pages
   ========================================================= */
.topbar{
  width:100%;
  background:rgba(255,255,255,.96);
  border-bottom:1px solid var(--line);
  position:sticky;
  top:0;
  z-index:1000;
  display:flex;
  justify-content:center;
  backdrop-filter:saturate(140%) blur(10px);
  -webkit-backdrop-filter:saturate(140%) blur(10px);
  direction:ltr;
}
.topbar-inner{
  width:100%;
  max-width:var(--container-wide);
  padding:12px 22px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:18px;
}
.topbar-left{
  text-decoration:none;
  font-weight:var(--fw-bold);
  font-size:var(--fs-sm);
  letter-spacing:.14em;
  color:var(--ink);
  white-space:nowrap;
}
.topbar-actions{
  display:flex;
  align-items:center;
  gap:2px;
  overflow-x:auto;
  scrollbar-width:none;
}
.topbar-actions::-webkit-scrollbar{display:none;}

.topbar-btn{
  text-decoration:none;
  font-size:var(--fs-sm);
  font-weight:var(--fw-semi);
  color:var(--muted);
  padding:8px 14px;
  border:1px solid transparent;
  border-radius:var(--r-md);
  white-space:nowrap;
  letter-spacing:.01em;
  transition:background .15s ease, border-color .15s ease, color .15s ease;
}
.topbar-btn:hover{
  background:var(--surface-2);
  color:var(--ink);
}
.topbar-btn.active{
  color:var(--ink);
  background:var(--surface-2);
}
.topbar-btn.primary{
  background:var(--gold-soft);
  border-color:var(--gold-border);
  color:#5a4413;
  font-weight:var(--fw-bold);
}
.topbar-btn.primary:hover{
  background:#f6efd2;
  border-color:var(--gold);
  color:#3f2e08;
}

/* =========================================================
   Page shell & cards
   ========================================================= */
.page-shell{
  width:min(100% - 32px, var(--container));
  margin:34px auto 44px;
}
.content-card{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--r-lg);
  box-shadow:var(--shadow-md);
  padding:32px;
}

/* =========================================================
   Typography — unified hierarchy
   ========================================================= */
.page-kicker{
  margin:0 0 10px;
  color:var(--muted);
  font-size:var(--fs-xs);
  font-weight:var(--fw-bold);
  letter-spacing:.14em;
  text-transform:uppercase;
  direction:ltr;
  text-align:right;
}
h1{
  margin:0;
  color:var(--ink);
  font-size:var(--fs-4xl);
  line-height:1.15;
  font-weight:var(--fw-bold);
  letter-spacing:-.005em;
}
.page-subtitle{
  margin:12px 0 0;
  color:var(--muted);
  font-size:var(--fs-md);
  line-height:1.65;
}
.page-meta{
  margin:14px 0 0;
  color:var(--muted);
  font-size:var(--fs-sm);
}

/* =========================================================
   Terms / long-form content
   ========================================================= */
.terms-content{margin-top:28px;display:grid;gap:20px;}
.terms-section{border-top:1px solid var(--line-soft);padding-top:20px;}
.terms-section:first-child{border-top:0;padding-top:0;}
.terms-section h2{
  margin:0 0 12px;
  color:var(--ink);
  font-size:var(--fs-xl);
  line-height:1.4;
  font-weight:var(--fw-bold);
}
.terms-section p{
  margin:0 0 10px;
  color:var(--ink-soft);
  font-size:var(--fs-md);
  line-height:1.8;
}
.terms-section p:last-child{margin-bottom:0;}
.terms-section ul{
  margin:0 0 10px;
  padding:0 22px 0 0;
  color:var(--ink-soft);
  font-size:var(--fs-md);
  line-height:1.75;
}
.terms-section li{margin:0 0 5px;}

/* =========================================================
   Contact form
   ========================================================= */
.contact-layout{width:min(100% - 32px, 760px);}
.contact-form{margin-top:28px;display:grid;gap:16px;}
.form-field{display:grid;gap:7px;}
.form-label{
  font-size:var(--fs-sm);
  font-weight:var(--fw-semi);
  color:var(--ink-soft);
}
.form-field input,
.form-field textarea{
  width:100%;
  border:1px solid var(--line);
  border-radius:var(--r-md);
  background:var(--surface);
  color:var(--ink);
  font:inherit;
  font-size:var(--fs-md);
  padding:12px 14px;
  outline:none;
  transition:border-color .15s ease, box-shadow .15s ease;
}
.form-field input:focus,
.form-field textarea:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(15,23,42,.08);
}
.form-field textarea{min-height:150px;resize:vertical;line-height:1.6;}
.honey-field{display:none!important;}
.form-actions{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  margin-top:6px;
}
.submit-btn{
  appearance:none;
  border:1px solid var(--accent);
  border-radius:var(--r-md);
  background:var(--accent);
  color:var(--accent-ink);
  font:inherit;
  font-size:var(--fs-md);
  font-weight:var(--fw-semi);
  padding:12px 24px;
  cursor:pointer;
  transition:background .15s ease, border-color .15s ease;
}
.submit-btn:hover{background:var(--accent-hover);border-color:var(--accent-hover);}
.form-status{
  min-height:20px;
  margin:0;
  color:var(--pos);
  font-size:var(--fs-sm);
  font-weight:var(--fw-semi);
}
.contact-direct{
  margin:18px 0 0;
  color:var(--muted);
  font-size:var(--fs-base);
  line-height:1.65;
}
.contact-direct a{
  color:var(--ink);
  font-weight:var(--fw-semi);
  text-decoration:none;
  border-bottom:1px solid var(--line);
}

/* =========================================================
   Footer
   ========================================================= */
.site-footer{
  width:min(100% - 32px, var(--container));
  margin:0 auto 32px;
  padding:2px 0 0;
  display:flex;
  justify-content:center;
  align-items:center;
  gap:10px;
  color:var(--muted);
  font-size:var(--fs-sm);
  direction:rtl;
}
.site-footer a{
  color:var(--muted);
  text-decoration:none;
  font-weight:var(--fw-medium);
}
.site-footer a:hover{
  color:var(--ink);
  text-decoration:underline;
  text-underline-offset:3px;
}

/* =========================================================
   Premium portal
   ========================================================= */
.premium-page{direction:ltr;text-align:left;background:var(--bg);}
.premium-shell{width:min(100% - 32px, var(--container));margin-top:28px;}
.premium-hero{margin:16px 0 22px;}
.premium-hero h1{font-size:clamp(28px, 3.6vw, 38px);max-width:820px;}
.premium-page .page-kicker{text-align:left;color:var(--muted);}
.premium-page .page-subtitle{max-width:780px;font-size:var(--fs-lg);}
.premium-user-line{margin:10px 0 0;color:var(--muted);font-size:var(--fs-sm);}

.premium-grid{
  display:grid;
  grid-template-columns:repeat(4, minmax(0,1fr));
  gap:12px;
  align-items:stretch;
}
.premium-card{
  display:flex;
  flex-direction:column;
  gap:8px;
  min-height:120px;
  padding:16px 18px;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--r-lg);
  text-decoration:none;
  color:inherit;
  box-shadow:var(--shadow-sm);
  transition:border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.premium-card:hover{
  border-color:var(--muted-2);
  box-shadow:var(--shadow-md);
  transform:translateY(-1px);
}
.premium-card.primary{
  order:4;
  border-color:var(--gold-border);
  background:var(--gold-soft);
  color:var(--ink);
}
.premium-card.primary:hover{
  border-color:var(--gold);
  background:#f6efd2;
}
.premium-card.primary small{color:#6b5421;}
.premium-card.primary .premium-card-kicker{color:#7a5c1a;}
.premium-card-kicker{
  font-size:var(--fs-xs);
  font-weight:var(--fw-bold);
  letter-spacing:.12em;
  text-transform:uppercase;
  color:var(--muted);
}
.premium-card strong{
  font-size:var(--fs-lg);
  line-height:1.25;
  color:inherit;
  font-weight:var(--fw-bold);
}
.premium-card small{
  margin-top:auto;
  font-size:var(--fs-sm);
  line-height:1.45;
  color:var(--muted);
}

.premium-note{
  margin-top:14px;
  display:flex;
  gap:10px;
  align-items:flex-start;
  padding:12px 14px;
  border:1px solid var(--line);
  background:var(--surface-2);
  border-radius:var(--r-md);
  color:var(--ink-soft);
  font-size:var(--fs-sm);
  line-height:1.55;
}
.premium-note strong{color:var(--ink);white-space:nowrap;}

/* =========================================================
   Premium auth
   ========================================================= */
.auth-page{min-height:100vh;background:var(--surface-2);}
.auth-shell{width:min(100% - 32px, 440px);margin:54px auto;}
.auth-card{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--r-lg);
  box-shadow:var(--shadow-md);
  padding:28px;
}
.auth-brand-link{
  display:inline-flex;
  margin-bottom:18px;
  color:var(--ink);
  text-decoration:none;
  font-size:var(--fs-sm);
  font-weight:var(--fw-bold);
  letter-spacing:.14em;
}
.auth-card h1{margin:0 0 10px;font-size:var(--fs-3xl);line-height:1.15;}
.auth-subtitle,.auth-small,.auth-switch{color:var(--muted);font-size:var(--fs-base);line-height:1.6;}
.auth-small{font-size:var(--fs-sm);}
.auth-error{
  background:var(--neg-soft);
  border:1px solid var(--neg-border);
  color:var(--neg);
  border-radius:var(--r-md);
  padding:10px 12px;
  font-size:var(--fs-sm);
  font-weight:var(--fw-semi);
}
.auth-success{
  background:var(--pos-soft);
  border:1px solid var(--pos-border);
  color:var(--pos);
  border-radius:var(--r-md);
  padding:10px 12px;
  font-size:var(--fs-sm);
  font-weight:var(--fw-semi);
}
.auth-form{display:grid;gap:10px;margin-top:18px;}
.auth-form label{font-size:var(--fs-sm);font-weight:var(--fw-semi);color:var(--ink-soft);}
.auth-form input{
  width:100%;
  border:1px solid var(--line);
  border-radius:var(--r-md);
  background:var(--surface);
  color:var(--ink);
  font:inherit;
  font-size:var(--fs-md);
  padding:12px 14px;
  outline:none;
}
.auth-form input:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(15,23,42,.08);
}
.auth-button{
  appearance:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid var(--accent);
  border-radius:var(--r-md);
  background:var(--accent);
  color:var(--accent-ink);
  text-decoration:none;
  font:inherit;
  font-size:var(--fs-md);
  font-weight:var(--fw-semi);
  padding:12px 18px;
  cursor:pointer;
  margin-top:4px;
}
.auth-button:hover{background:var(--accent-hover);border-color:var(--accent-hover);}
.auth-switch a{color:var(--ink);font-weight:var(--fw-semi);text-decoration:none;border-bottom:1px solid var(--line);}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width:920px){
  .premium-grid{grid-template-columns:1fr 1fr;}
  .premium-card.primary{order:0;}
  .premium-card{min-height:108px;}
}

@media (max-width:800px){
  .topbar-inner{padding:10px 14px;}
}

@media (max-width:640px){
  .topbar-inner{
    padding:12px 14px;
    align-items:stretch;
    flex-direction:column;
    gap:10px;
  }
  .topbar-left{text-align:center;font-size:var(--fs-sm);}
  .topbar-actions{
    width:100%;
    display:grid;
    grid-template-columns:repeat(3, minmax(0,1fr));
    gap:6px;
    overflow:visible;
  }
  .topbar-btn{
    min-height:44px;
    display:flex;
    align-items:center;
    justify-content:center;
    text-align:center;
    font-size:var(--fs-xs);
    line-height:1.2;
    padding:8px 6px;
    border-radius:var(--r-md);
    border:1px solid var(--line);
    background:var(--surface);
    white-space:normal;
  }
  .topbar-btn.active{background:var(--surface-2);border-color:var(--muted-2);}
  .topbar-btn.primary{background:var(--gold-soft);border-color:var(--gold-border);}

  .page-shell{width:min(100% - 20px, 760px);margin:22px auto 32px;}
  .content-card{padding:22px 18px;}
  h1{font-size:var(--fs-3xl);}
  .terms-section h2{font-size:var(--fs-lg);}
  .terms-section p,.terms-section ul{font-size:var(--fs-base);line-height:1.7;}
  .form-actions{align-items:stretch;flex-direction:column;}
  .submit-btn{width:100%;}
  .site-footer{width:min(100% - 20px,760px);margin-bottom:24px;}

  .premium-shell{width:min(100% - 20px, 760px);}
  .premium-hero h1{font-size:var(--fs-3xl);}
  .premium-grid{grid-template-columns:1fr;}
  .premium-card{min-height:106px;}
  .premium-note{display:block;}
  .premium-note strong{display:block;margin-bottom:5px;}

  .auth-shell{width:min(100% - 20px, 440px);margin:28px auto;}
  .auth-card{padding:22px 18px;}
  .auth-card h1{font-size:var(--fs-2xl);}
}
