:root {
  --blue: #0f5bff;
  --blue-deep: #062b86;
  --ink: #07142f;
  --muted: #64708a;
  --line: #dce4f2;
  --paper: #f6f9ff;
  --white: #ffffff;
  --danger: #d62b55;
  --ok: #0b8f6a;
  --shadow: 0 24px 70px rgba(7, 20, 47, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(15, 91, 255, .07) 1px, transparent 1px),
    linear-gradient(0deg, rgba(15, 91, 255, .06) 1px, transparent 1px),
    var(--paper);
  background-size: 48px 48px;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, .btn {
  border: 0;
  background: var(--blue);
  color: #fff;
  padding: 12px 16px;
  min-height: 42px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 6px 6px 0 var(--ink);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
button:hover, .btn:hover { transform: translate(-2px, -2px); box-shadow: 9px 9px 0 var(--ink); }
.btn.ghost, button.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  font: inherit;
  border-radius: 0;
}
textarea { resize: vertical; }
label { display: grid; gap: 7px; font-weight: 750; color: var(--ink); }
small { color: var(--muted); display: block; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto 1fr minmax(180px, 260px) auto;
  gap: 18px;
  align-items: center;
  padding: 14px clamp(16px, 4vw, 54px);
  background: rgba(246, 249, 255, .88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.brand img { width: 184px; }
.main-nav { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.main-nav a, .user-nav a {
  padding: 9px 10px;
  font-weight: 850;
  font-size: 14px;
  border-left: 4px solid var(--accent, transparent);
}
.main-nav a:hover, .user-nav a:hover { background: #fff; color: var(--blue); }
.user-nav { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.search-mini input { min-height: 38px; padding: 9px 10px; }
.nav-toggle { display: none; box-shadow: none; padding: 8px; background: #fff; border: 1px solid var(--line); }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--ink); margin: 5px; }
.flash {
  max-width: 1180px;
  margin: 18px auto 0;
  padding: 13px 16px;
  background: #dff8ef;
  border-left: 6px solid var(--ok);
  font-weight: 800;
}
.flash.error { background: #ffe8ee; border-color: var(--danger); }

main { min-height: 72vh; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, .88fr);
  gap: 24px;
  align-items: stretch;
  width: min(1180px, calc(100% - 32px));
  margin: 36px auto;
}
.hero-copy, .featured-card, .page-head, .auth-card, .admin-panel, .trend-panel, .comments-panel {
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.hero-copy {
  padding: clamp(28px, 6vw, 72px);
  min-height: 470px;
  display: grid;
  align-content: center;
  position: relative;
  overflow: hidden;
}
.hero-copy::after {
  content: "";
  position: absolute;
  right: 28px;
  top: 28px;
  width: 110px;
  aspect-ratio: 1;
  background: url('/public/assets/img/Logo.png') center / contain no-repeat;
  opacity: .13;
}
.kicker, .tag {
  display: inline-flex;
  width: max-content;
  background: color-mix(in srgb, var(--accent, var(--blue)) 14%, white);
  color: var(--accent, var(--blue));
  border: 1px solid color-mix(in srgb, var(--accent, var(--blue)) 38%, white);
  padding: 7px 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 950;
}
h1, h2, h3, p { overflow-wrap: anywhere; }
.hero-copy h1, .page-head h1, .article-hero h1 {
  margin: 18px 0;
  font-size: clamp(34px, 5.4vw, 66px);
  line-height: 1;
  letter-spacing: 0;
}
.hero-copy p, .page-head p, .article-hero p {
  max-width: 760px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}
.hero-search { display: flex; gap: 10px; margin-top: 24px; max-width: 660px; }
.hero-search.compact { margin: 0; }
.featured-card {
  min-height: 470px;
  padding: 24px;
  display: grid;
  grid-template-rows: minmax(170px, 42%) 1fr;
  gap: 22px;
  background: linear-gradient(145deg, var(--blue), #061b56 72%);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.featured-card::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(255,255,255,.24);
}
.featured-media {
  z-index: 1;
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.28);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.featured-media img {
  width: 100%;
  height: 100%;
  min-height: 170px;
  object-fit: cover;
}
.featured-media img[src$="Logo.png"] {
  width: min(170px, 52%);
  height: auto;
  min-height: 0;
  object-fit: contain;
  opacity: .9;
}
.featured-copy {
  z-index: 1;
  align-self: end;
}
.featured-card h2 { font-size: clamp(26px, 3.2vw, 42px); line-height: 1.04; margin: 18px 0 12px; z-index: 1; }
.featured-card p, .featured-card small, .featured-card .tag { z-index: 1; }
.featured-card p { color: rgba(255,255,255,.82); font-size: 18px; line-height: 1.5; }
.featured-card small { color: rgba(255,255,255,.72); }

.content-grid {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 24px;
}
.section-head, .admin-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 16px;
}
.section-head h2, .admin-title h1 { margin: 0; font-size: clamp(26px, 4vw, 44px); }
.section-head span { color: var(--muted); font-weight: 800; }
.article-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.article-grid.wide {
  width: min(1180px, calc(100% - 32px));
  margin: 26px auto 72px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.article-card {
  background: #fff;
  border: 1px solid var(--line);
  transition: transform .18s ease, box-shadow .18s ease;
}
.article-card:hover { transform: translateY(-4px); box-shadow: 12px 12px 0 rgba(15,91,255,.16); }
.article-card > a { display: grid; height: 100%; }
.article-card img, .cover-fallback {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: linear-gradient(135deg, #dce8ff, #fff);
}
.cover-fallback { display: grid; place-items: center; }
.cover-fallback img { width: 90px; height: auto; aspect-ratio: auto; background: transparent; }
.card-body { padding: 18px; display: grid; gap: 10px; }
.card-body h3 { margin: 0; font-size: 22px; line-height: 1.12; }
.card-body p { margin: 0; color: var(--muted); line-height: 1.45; }
.trend-panel { padding: 22px; position: sticky; top: 94px; height: max-content; }
.trend-panel h2 { margin-top: 0; }
.trend-panel a {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.trend-panel b { color: var(--blue); font-size: 24px; }
.trend-panel span { font-weight: 850; line-height: 1.25; }

.page-head {
  width: min(1180px, calc(100% - 32px));
  margin: 36px auto 24px;
  padding: clamp(28px, 5vw, 64px);
}
.article-banner {
  width: 100%;
  margin: 0 0 32px;
  border-bottom: 1px solid var(--line);
  background: #dce8ff;
}
.article-banner img {
  width: 100%;
  height: clamp(220px, 32vw, 390px);
  object-fit: cover;
}
.article-page { width: min(980px, calc(100% - 32px)); margin: 34px auto; }
.article-banner + .article-page { margin-top: 0; }
.article-hero { padding: 18px 0 28px; }
.article-hero h1 { font-size: clamp(34px, 5.4vw, 64px); }
.meta { color: var(--muted); font-weight: 800; }
.article-body {
  background: #fff;
  border: 1px solid var(--line);
  padding: clamp(22px, 4vw, 52px);
  font-size: 19px;
  line-height: 1.75;
}
.article-body h2 { font-size: 34px; line-height: 1.1; margin-top: 34px; }
.article-body blockquote { margin: 28px 0; padding: 20px; border-left: 8px solid var(--blue); background: #eef4ff; font-weight: 800; }
.comments-panel, .related { width: min(980px, calc(100% - 32px)); margin: 24px auto 64px; padding: 24px; }
.comment-form { display: grid; gap: 12px; margin-bottom: 18px; }
.comment { padding: 16px 0; border-top: 1px solid var(--line); }
.comment span { color: var(--muted); margin-left: 8px; font-size: 13px; }
.auth-card { width: min(480px, calc(100% - 32px)); margin: 60px auto; padding: 34px; }
.auth-card form, .settings-form, .mini-form, .page-form { display: grid; gap: 15px; }

.site-footer {
  background: var(--ink);
  color: rgba(255,255,255,.72);
  padding: 42px clamp(16px, 4vw, 54px);
  display: grid;
  gap: 8px;
}
.site-footer img { width: 170px; }

.admin-shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); background: #eef4ff; }
.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--ink);
  padding: 22px;
  color: #fff;
}
.admin-sidebar .admin-logo {
  display: block;
  padding: 0;
  margin-bottom: 28px;
  border: 0;
}
.admin-sidebar .admin-logo:hover { background: transparent; }
.admin-sidebar .admin-logo img { width: 180px; margin-bottom: 0; }
.admin-sidebar nav { display: grid; gap: 8px; }
.admin-sidebar a { padding: 12px; font-weight: 850; border: 1px solid rgba(255,255,255,.08); }
.admin-sidebar a:hover { background: var(--blue); }
.admin-main { padding: 24px; min-width: 0; }
.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 14px 16px;
  margin-bottom: 22px;
}
.admin-topbar span { color: var(--muted); margin-left: 10px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { background: #fff; border: 1px solid var(--line); padding: 22px; box-shadow: 8px 8px 0 rgba(15,91,255,.11); }
.stat span { color: var(--muted); text-transform: uppercase; font-size: 12px; font-weight: 950; }
.stat b { display: block; font-size: 42px; margin-top: 8px; }
.admin-panel { padding: 22px; margin-bottom: 20px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 13px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
td small { margin-top: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions form { display: inline-flex; gap: 6px; align-items: center; }
.actions button, .actions a, td > button {
  min-height: 34px;
  padding: 8px 10px;
  box-shadow: none;
  background: #eef4ff;
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 850;
}
.editor-form { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 20px; }
.editor-main, .editor-side {
  background: #fff;
  border: 1px solid var(--line);
  padding: 20px;
  display: grid;
  gap: 15px;
  height: max-content;
}
.editor-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.editor-tools button { box-shadow: none; min-height: 34px; padding: 8px 10px; background: #eef4ff; color: var(--ink); border: 1px solid var(--line); }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }
.preview { border: 1px solid var(--line); aspect-ratio: 16 / 9; object-fit: cover; }
.split-panel { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; }
.inline-editor { display: grid; grid-template-columns: 1fr 180px; gap: 10px; align-items: start; padding: 16px 0; border-bottom: 1px solid var(--line); }
.inline-editor textarea { grid-column: 1 / -1; }
.delete-row { margin-bottom: 14px; }

.reveal { opacity: 0; transform: translateY(18px); transition: opacity .5s ease, transform .5s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 980px) {
  .site-header { grid-template-columns: auto auto; }
  .nav-toggle { display: block; justify-self: end; }
  .main-nav, .search-mini, .user-nav { display: none; grid-column: 1 / -1; }
  .main-nav.is-open, .main-nav.is-open ~ .search-mini, .main-nav.is-open ~ .user-nav { display: flex; }
  .search-mini { width: 100%; }
  .user-nav { flex-wrap: wrap; }
  .hero-grid, .content-grid, .editor-form, .split-panel { grid-template-columns: 1fr; }
  .hero-copy, .featured-card { min-height: auto; }
  .featured-card { grid-template-rows: 190px auto; }
  .article-grid.wide, .article-grid { grid-template-columns: 1fr; }
  .trend-panel { position: static; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; height: auto; }
  .admin-sidebar nav { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .brand img { width: 150px; }
  .hero-search, .section-head, .admin-title, .admin-topbar { flex-direction: column; align-items: stretch; }
  .hero-copy h1, .page-head h1, .article-hero h1 { font-size: 34px; line-height: 1.05; }
  .article-banner img { height: 220px; }
  .article-body { font-size: 17px; }
  .stat-grid { grid-template-columns: 1fr; }
  .admin-main { padding: 14px; }
  .admin-sidebar nav { grid-template-columns: 1fr; }
  .inline-editor { grid-template-columns: 1fr; }
}
