/* Livira Portal - base: reset, typography, links, topbar, footer, forms/auth, legal pages. */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
}
h1, .editorial { font-family: var(--font-serif); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- topbar ---------- */
.topbar { background: var(--white); color: var(--green); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1100; }
.topbar-inner {
  max-width: 1440px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 22px;
  position: relative; /* anchors .topbar-menu when it drops down on mobile */
}
.logo { display: flex; align-items: center; flex: none; }
.logo img { height: 26px; display: block; }

/* Desktop: everything after the logo is one inline row. <=1024px this block is the
   dropdown panel toggled by the hamburger (below). */
.topbar-menu { display: flex; align-items: center; gap: 18px; flex: 1; min-width: 0; }

.tabs { display: flex; gap: 6px; flex: none; }
.tabs a { padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--green); }
.tabs a:hover { background: var(--sand); }
.tabs .disabled { opacity: 0.45; cursor: default; pointer-events: none; }

.search-form { flex: 1; display: flex; max-width: 440px; min-width: 0; margin-left: auto; }
.search-form input {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-right: none; border-radius: 10px 0 0 10px;
  padding: 9px 12px; font-size: 14px; font-family: inherit;
}
.search-form button {
  border: none; background: var(--gold); color: var(--green-deep); padding: 9px 16px;
  border-radius: 0 10px 10px 0; font-weight: 700; cursor: pointer; flex: none;
}
.search-form button:hover { background: var(--gold-dark); }

.topbar-actions { display: flex; gap: 12px; align-items: center; white-space: nowrap; flex: none; font-size: 14px; font-weight: 600; }
.topbar-actions a.link { color: var(--green); display: inline-flex; align-items: center; gap: 6px; }
.topbar-actions a.link:hover { text-decoration: underline; }
.btn-outline { border: 1.5px solid var(--green); color: var(--green); border-radius: 999px; padding: 7px 16px; font-weight: 600; }
.btn-outline:hover { background: var(--sand); }
.user-name { font-weight: 600; color: var(--green); }
.link-btn {
  background: none; border: none; padding: 0; font: inherit; color: var(--ink-soft);
  cursor: pointer; text-decoration: underline;
}
.link-btn:hover { color: var(--green); }

/* Logged-in account menu: native <details>, no JS. */
.user-menu { position: relative; }
.user-menu summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 12px 6px 8px; font-weight: 600;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu[open] summary, .user-menu summary:hover { border-color: var(--green); }
.user-menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; z-index: 60;
  background: var(--white); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg);
  padding: 6px; display: flex; flex-direction: column;
}
.user-menu-panel a, .user-menu-panel .link-btn {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px;
  color: var(--green); font-weight: 600; text-decoration: none;
}
.user-menu-panel a:hover, .user-menu-panel .link-btn:hover { background: var(--sand); }
.user-menu-panel form { margin: 0; }

/* Hamburger toggle - checkbox hack, no JS needed. Hidden on desktop. */
.nav-toggle-input { position: absolute; opacity: 0; pointer-events: none; }
.nav-toggle-btn { display: none; flex: none; padding: 6px; cursor: pointer; color: var(--green); }
.nav-toggle-btn .ico { width: 24px; height: 24px; }

/* 1024px, not a narrower "mobile-only" value: the full inline header (logo + nav + search + actions,
   more items still when logged in) genuinely doesn't fit at tablet widths either (verified breaking
   at 768px). Matches the .search-layout breakpoint on purpose. */
@media (max-width: 1024px) {
  .nav-toggle-btn { display: flex; margin-left: auto; }
  .topbar-menu {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--white); border-bottom: 1px solid var(--line);
    padding: 4px 20px 16px; box-shadow: 0 8px 16px rgba(0,0,0,.06);
    max-height: calc(100vh - 62px); overflow-y: auto;
  }
  .nav-toggle-input:checked ~ .topbar-menu { display: flex; }
  .tabs { flex-direction: column; align-items: stretch; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .tabs a { display: block; }
  .search-form { max-width: none; margin: 12px 0; }
  .topbar-actions { flex-direction: column; align-items: flex-start; gap: 10px; padding: 12px 0 4px; }
  .user-menu { width: 100%; }
  .user-menu-panel { position: static; box-shadow: none; border: none; padding: 4px 0 0; }
}

/* ---------- auth forms ---------- */
.auth-page { max-width: 400px; margin: 60px auto; padding: 0 20px; }
.auth-page h1 { font-size: 26px; margin-bottom: 6px; }
.auth-page .sub { color: var(--ink-soft); font-size: 14px; margin-bottom: 24px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.auth-form input:not([type=checkbox]) {
  width: 100%; margin-top: 4px; padding: 10px; border: 1px solid var(--line);
  border-radius: 6px; font: inherit;
}
.auth-form button {
  background: var(--gold); color: var(--green); border: none; padding: 12px;
  border-radius: 6px; font-weight: 700; cursor: pointer; margin-top: 8px;
}
.auth-form button:hover { background: var(--gold-dark); }
.auth-error { background: #FBE8E4; border: 1px solid #E8B4A8; color: #8A3B27; padding: 10px 12px; border-radius: 6px; font-size: 14px; }
.auth-switch { margin-top: 18px; font-size: 14px; color: var(--ink-soft); }
.checkbox-line {
  display: flex; align-items: flex-start; gap: 8px; font-weight: 400; font-size: 13px;
  color: var(--ink-soft); cursor: pointer; width: 100%;
}
.checkbox-line input[type=checkbox] { margin-top: 3px; flex-shrink: 0; }
.auth-fineprint { font-size: 12px; color: var(--ink-soft); line-height: 1.5; }
.auth-fineprint a { color: var(--green); text-decoration: underline; }
.auth-divider {
  text-align: center; font-size: 12px; color: var(--ink-soft); margin: 16px 0;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.auth-oauth-btn {
  display: block; text-align: center; padding: 11px; border: 1px solid var(--line);
  border-radius: 6px; font-weight: 600; font-size: 14px; color: var(--ink);
  text-decoration: none; background: #fff;
}
.auth-oauth-btn:hover { background: #F7F5F0; }
.auth-forgot { text-align: right; margin: -4px 0 0; font-size: 13px; }
.auth-forgot a { color: var(--ink-soft); }
.auth-success { background: #E7F3EA; border: 1px solid #B7DCC0; color: #235C31; padding: 10px 12px; border-radius: 6px; font-size: 14px; }


/* ---------- legal pages (privacy/terms) ---------- */
.legal-page { max-width: 780px; margin: 0 auto; padding: 32px 20px 60px; line-height: 1.6; }
.legal-page h1 { font-size: 28px; margin-bottom: 4px; }
.legal-page h2 { font-size: 18px; margin-top: 32px; margin-bottom: 8px; color: var(--green); }
.legal-page p, .legal-page li { color: var(--ink); font-size: 15px; }
.legal-page ul { padding-left: 20px; }
.legal-updated { color: var(--ink-soft); font-size: 13px; margin-bottom: 24px; }
.legal-notice {
  background: var(--sand); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px;
  font-size: 14px;
}
.legal-table { width: 100%; border-collapse: collapse; margin: 12px 0 20px; font-size: 14px; }
.legal-table th, .legal-table td {
  border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top;
}
.legal-table th { background: var(--sand); font-weight: 600; }
.legal-disclaimer {
  margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--ink-soft); font-style: italic;
}


/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 24px 20px; background: var(--white); }
.site-footer-inner {
  max-width: 1440px; margin: 0 auto; display: flex; flex-wrap: wrap; justify-content: space-between;
  align-items: center; gap: 12px; font-size: 13px; color: var(--ink-soft);
}
.footer-brand { display: inline-flex; align-items: center; gap: 10px; }
.footer-brand img { height: 20px; display: block; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.footer-links a { color: var(--ink-soft); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; color: var(--green); }
