:root {
  --ink: #122033;
  --ink-soft: #2a3b52;
  --muted: #5f6f82;
  --fog: #eef3f7;
  --fog-2: #e2eaf1;
  --surface: #ffffff;
  --line: rgba(18, 32, 51, 0.1);
  --sea: #1f7a6c;
  --sea-deep: #155e54;
  --sea-soft: #d7efe9;
  --sand: #c9924a;
  --danger: #9b2c2c;
  --ok: #176b4a;
  --shadow: 0 20px 50px rgba(18, 32, 51, 0.08);
  --radius: 16px;
  --font: "Plus Jakarta Sans", system-ui, sans-serif;
  --display: "Instrument Serif", Georgia, serif;
  --header-h: 4.25rem;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 85% -5%, rgba(31, 122, 108, 0.12), transparent 55%),
    radial-gradient(700px 380px at 0% 20%, rgba(18, 32, 51, 0.06), transparent 50%),
    linear-gradient(180deg, #f7fafc 0%, var(--fog) 45%, #e8eef4 100%);
  min-height: 100vh;
  line-height: 1.6;
}

img { max-width: 100%; display: block; }
a { color: var(--sea); text-decoration: none; }
a:hover { text-decoration: underline; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: .6rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: .75rem; top: .75rem; }

.container {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(15, 39, 64, 0.92);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.nav-row {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .55rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-width: 0;
  text-decoration: none !important;
}
.brand-logo {
  width: auto;
  height: 2.75rem;
  max-width: 7.5rem;
  border-radius: 0;
  object-fit: contain;
  box-shadow: none;
  background: transparent;
  flex-shrink: 0;
  filter: none;
}
.hero-logo {
  width: min(200px, 42vw);
  height: auto;
  border-radius: 0;
  margin: 0 0 1rem;
  box-shadow: none;
  background: transparent;
  animation: rise .9s ease both;
  filter: none;
}
.footer-logo {
  width: 96px;
  height: auto;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  filter: none;
}
.brand-text {
  font-family: var(--display);
  font-size: clamp(1rem, 2.2vw, 1.4rem);
  letter-spacing: .01em;
  color: #fff;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-toggle {
  display: none;
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.06);
  color: #fff;
  border-radius: 10px;
  padding: .5rem .85rem;
  font: inherit;
  font-weight: 700;
  font-size: .9rem;
  flex-shrink: 0;
  cursor: pointer;
  line-height: 1;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1rem;
  align-items: center;
}
.nav-links a {
  color: rgba(240, 247, 252, 0.9);
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
}
.nav-links a:hover,
.nav-links a[aria-current="page"] { color: #fff; }

.nav-user {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .05rem;
  padding: .35rem .7rem;
  border-radius: 10px;
  background: rgba(255,255,255,.1);
  text-decoration: none !important;
  line-height: 1.2;
  max-width: 11rem;
}
.nav-user-name {
  color: #fff !important;
  font-weight: 700;
  font-size: .9rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-user-role {
  color: rgba(232, 240, 246, 0.75) !important;
  font-size: .72rem;
  font-weight: 600;
}
.nav-user:hover { background: rgba(255,255,255,.16); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: .6rem 1.15rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none !important;
  font-family: inherit;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-accent { background: var(--sea); color: #fff; }
.btn-accent:hover { background: var(--sea-deep); color: #fff; }
.btn-soft {
  background: rgba(255,255,255,.14);
  color: #fff;
  border-color: rgba(255,255,255,.28);
}
.btn-soft:hover { background: rgba(255,255,255,.22); color: #fff; }
.btn-ghost {
  background: transparent;
  border-color: rgba(255,255,255,.35);
  color: #fff;
}
.main-wrap .btn-ghost,
.section .btn-ghost,
.auth-card .btn-ghost,
.panel .btn-ghost {
  border-color: var(--line);
  color: var(--ink);
}
.btn-lg { padding: .85rem 1.4rem; font-size: 1.02rem; }
.btn-small { padding: .42rem .85rem; font-size: .88rem; border-radius: 10px; }
.btn-block { width: 100%; }

/* Full-bleed hero */
.hero-bleed {
  position: relative;
  min-height: calc(100svh - var(--header-h));
  display: grid;
  align-items: end;
  overflow: hidden;
  color: #f5f9fc;
  isolation: isolate;
}
.hero-visual {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(10, 24, 40, 0.35) 0%, rgba(10, 24, 40, 0.72) 55%, rgba(10, 24, 40, 0.88) 100%),
    radial-gradient(circle at 70% 30%, rgba(60, 184, 164, 0.35), transparent 42%),
    url("../img/og-default.png") center / cover no-repeat,
    linear-gradient(135deg, #0f2740, #1f7a6c);
  transform: scale(1.02);
  animation: drift 18s ease-in-out infinite alternate;
}
.hero-inner {
  padding: clamp(2.5rem, 8vh, 5.5rem) 0 clamp(3rem, 9vh, 6rem);
  max-width: 760px;
  margin-left: max(1rem, calc((100% - 1120px) / 2));
  margin-right: auto;
  animation: rise .8s ease both;
}
.brand-hero {
  font-family: var(--display);
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1.05;
  margin: 0 0 .85rem;
  letter-spacing: .01em;
}
.hero-bleed h1 {
  font-family: var(--font);
  font-weight: 700;
  font-size: clamp(1.25rem, 2.4vw, 1.75rem);
  line-height: 1.35;
  margin: 0 0 .85rem;
  max-width: 22ch;
  color: rgba(245, 249, 252, 0.96);
}
.hero-bleed .lead {
  margin: 0;
  max-width: 38ch;
  color: rgba(232, 240, 246, 0.86);
  font-size: 1.05rem;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1.6rem;
}

.section {
  padding: 3.25rem 0 1rem;
}
.section-head {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-bottom: 1.4rem;
}
.section-head h1,
.section-head h2,
.form-page h1,
.panel h1,
.prose h1,
.auth-card h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  margin: 0;
  color: var(--ink);
}
.section-head p { margin: 0; color: var(--muted); }

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.steps li {
  padding: 1.25rem 1.2rem;
  border-top: 2px solid var(--sea);
  background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,.55));
}
.step-num {
  display: block;
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .08em;
  color: var(--sea);
  margin-bottom: .55rem;
}
.steps h3 {
  margin: 0 0 .35rem;
  font-size: 1.15rem;
}
.steps p {
  margin: 0;
  color: var(--muted);
  font-size: .95rem;
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1rem;
}
.entry-card,
.auth-card,
.stat-card,
.queue-card,
.empty-state,
.entry-detail {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.entry-card {
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  transition: transform .2s ease, box-shadow .2s ease;
}
.entry-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 50px rgba(18, 32, 51, 0.12);
}
.entry-card h3 {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 400;
  margin: 0;
  line-height: 1.25;
}
.entry-card h3 a { color: var(--ink); text-decoration: none; }
.entry-card h3 a:hover { color: var(--sea); }
.entry-card-top {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: start;
}
.entry-card-foot {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  color: var(--muted);
  font-size: .9rem;
}

.badge, .tag, .share-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  padding: .22rem .55rem;
  font-size: .75rem;
  font-weight: 700;
  background: var(--sea-soft);
  color: var(--sea-deep);
  white-space: nowrap;
}
.share-pill { background: #f4e7d4; color: #8a5a1f; }
.meta, .muted { color: var(--muted); }
.tiny { font-size: .85rem; }
.center { text-align: center; }

.empty-state {
  padding: 2.4rem 1.5rem;
  text-align: center;
}
.empty-state h3, .empty-state h1 { font-family: var(--display); font-weight: 400; }

.main-wrap,
.form-page,
.auth-shell,
.panel,
.prose,
.profile-wrap,
.entry-wrap {
  width: min(1120px, calc(100% - 2rem));
  margin: 2rem auto 3.5rem;
}

.auth-shell { display: grid; place-items: start center; }
.auth-card {
  width: min(430px, 100%);
  padding: 1.7rem;
  animation: rise .55s ease both;
}
.stack-form { display: grid; gap: .9rem; }
.stack-form label { display: grid; gap: .35rem; font-weight: 600; }
.stack-form input,
.stack-form textarea,
.stack-form select,
.queue-card textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .75rem .85rem;
  font: inherit;
  background: #fff;
}
.stack-form input:focus,
.stack-form textarea:focus,
.stack-form select:focus {
  outline: 2px solid rgba(31, 122, 108, .25);
  border-color: var(--sea);
}
.form-wide { width: min(720px, 100%); }
.form-page .lead { margin-top: .4rem; color: var(--muted); }

.consent-box {
  display: flex !important;
  gap: .75rem;
  align-items: start;
  background: #f3faf8;
  border: 1px solid rgba(31, 122, 108, .22);
  border-radius: 14px;
  padding: 1rem;
  font-weight: 500 !important;
}
.consent-box input { width: auto; margin-top: .25rem; }

.tag-field { border: 1px solid var(--line); border-radius: 14px; padding: 1rem; }
.tag-grid { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  display: inline-flex;
  gap: .35rem;
  align-items: center;
  background: var(--fog-2);
  border-radius: 10px;
  padding: .35rem .7rem;
  font-weight: 600;
}
.chip input { width: auto; }

.entry-detail { padding: clamp(1.25rem, 3vw, 2rem); }
.entry-detail h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  margin: .3rem 0 .8rem;
}
.entry-body { font-size: 1.08rem; }
.entry-actions, .inline-actions, .queue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: end;
  margin-top: 1.2rem;
}
.tag-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }

.comment-list, .simple-list, .note-list, .theme-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: .85rem;
}
.comment-list li, .note-list li, .queue-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
}
.theme-list li {
  display: flex;
  justify-content: space-between;
  padding: .7rem .9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .8rem;
  margin: 1rem 0 1.2rem;
}
.stat-card { padding: 1rem; text-align: center; }
.stat-card strong {
  display: block;
  font-family: var(--display);
  font-size: 1.9rem;
  font-weight: 400;
}
.panel-nav { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }
.section-head .btn { align-self: center; }
.two-col {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.25rem;
}

.flash-wrap { padding-top: 1rem; display: grid; gap: .5rem; }
.flash {
  border-radius: 12px;
  padding: .75rem 1rem;
  font-weight: 600;
}
.flash-success { background: #e5f5ec; color: var(--ok); }
.flash-error { background: #f8e6e6; color: var(--danger); }

.site-footer {
  margin-top: 3rem;
  border-top: 1px solid var(--line);
  padding: 2.4rem 0 2rem;
  background: rgba(255,255,255,.55);
}
.footer-brand {
  font-family: var(--display);
  font-size: 1.5rem;
  margin: 0 0 .4rem;
}
.footer-logo-link {
  display: inline-block;
  text-decoration: none !important;
  margin-bottom: .6rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr .8fr 1.2fr;
  gap: 1.25rem;
}
.footer-grid nav {
  display: grid;
  gap: .45rem;
  align-content: start;
}
.footer-grid nav a { color: var(--ink-soft); font-weight: 600; text-decoration: none; }
.footer-grid nav a:hover { color: var(--sea); }
.footer-copy { margin-top: 1.5rem; color: var(--muted); }
.prose { max-width: 65ch; }
.prose h2 { font-family: var(--display); font-weight: 400; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes drift {
  from { transform: scale(1.02) translate3d(0, 0, 0); }
  to { transform: scale(1.06) translate3d(-1.5%, 1%, 0); }
}

@media (max-width: 860px) {
  :root { --header-h: 3.6rem; }

  .nav-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand toggle"
      "nav nav";
    align-items: center;
    gap: .55rem .65rem;
    padding: .55rem 0 .65rem;
  }

  .brand { grid-area: brand; max-width: 100%; }
  .nav-toggle {
    grid-area: toggle;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.4rem;
  }

  .brand-logo {
    height: 2rem;
    max-width: 4.75rem;
  }
  .brand-text {
    font-size: .95rem;
  }

  .nav-links {
    grid-area: nav;
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: .35rem;
    margin: 0;
    padding: .55rem 0 .15rem;
    border-top: 1px solid rgba(255,255,255,.12);
  }
  .nav-links.is-open { display: flex; }

  .nav-links a {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 2.65rem;
    padding: .55rem .75rem;
    border-radius: 10px;
    font-size: .95rem;
    background: rgba(255,255,255,.04);
  }
  .nav-links a:hover,
  .nav-links a[aria-current="page"] {
    background: rgba(255,255,255,.1);
  }

  .nav-links .btn,
  .nav-links .btn-ghost,
  .nav-links .btn-accent {
    width: 100%;
    justify-content: center;
    margin-top: .15rem;
  }

  .nav-user {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
  }

  .hero-logo {
    width: min(132px, 38vw);
  }

  .steps, .stat-grid, .two-col, .footer-grid { grid-template-columns: 1fr; }
  .hero-inner { margin-left: 1rem; margin-right: 1rem; width: auto; }
  .brand-hero { font-size: clamp(2.2rem, 10vw, 3.2rem); }
}

@media (max-width: 420px) {
  .brand {
    gap: .4rem;
  }
  .brand-text {
    display: inline;
    font-size: .82rem;
    max-width: 9.5rem;
  }
  .brand-logo {
    height: 1.75rem;
    max-width: 4.25rem;
  }
  .hero-logo {
    width: min(112px, 42vw);
  }
}
