/* ---------- Design tokens ---------- */
:root {
  --color-bg: #f6efdd;
  --color-surface: #fffbf2;
  --color-header: #2c2c18;
  --color-header-text: #f3ecd8;
  --color-nav: #3c3b21;
  --color-nav-text: #e9e3cc;
  --color-accent: #dd7a2c;
  --color-accent-dark: #bf6620;
  --color-text: #2a2818;
  --color-text-muted: #6d6a54;
  --color-border: #e7dcc0;
  --color-olive: #4c4b2c;

  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 2px 10px rgba(43, 40, 20, 0.08);
  --container-width: 1180px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input {
  font-family: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.btn--accent {
  background: var(--color-accent);
  color: #fff;
}
.btn--accent:hover {
  background: var(--color-accent-dark);
}

.btn--outline {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn--ghost {
  background: transparent;
  color: var(--color-olive);
  border: 1px solid var(--color-border);
}

/* ---------- Splash screen ---------- */
.splash {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 19, 10, 0.96);
  transition: opacity 0.35s ease;
}

.splash--hidden {
  opacity: 0;
  pointer-events: none;
}

.splash-circle {
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.splash-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    var(--color-accent) 0deg,
    #ffb877 90deg,
    rgba(221, 122, 44, 0) 200deg,
    rgba(221, 122, 44, 0) 360deg
  );
  animation: splash-rotate 1.2s linear infinite;
  box-shadow: 0 0 32px rgba(221, 122, 44, 0.7);
}

.splash-icon {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-header);
  box-shadow: 0 0 0 5px #8a6a3a;
  display: flex;
  align-items: center;
  justify-content: center;
}

.splash-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.splash-icon img.icon-visible {
  opacity: 1;
}

@keyframes splash-rotate {
  to { transform: rotate(360deg); }
}

/* ---------- Auth ---------- */
.topbar-auth {
  background: none;
  border: 1px solid rgba(243, 236, 216, 0.4);
  border-radius: 999px;
  color: inherit;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 4px 12px;
}

.topbar-auth:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(20, 19, 10, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  position: relative;
  width: min(360px, 100%);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 22px;
  height: 22px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.modal-close::before,
.modal-close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 2px;
  background: var(--color-text-muted);
  transform-origin: center;
}

.modal-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.modal-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.modal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.modal-tab {
  flex: 1;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
}

.modal-tab--active {
  background: var(--color-header);
  border-color: var(--color-header);
  color: var(--color-header-text);
}

.modal-title {
  margin: 0 0 18px;
  font-size: 1.2rem;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.modal-field input {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 0.95rem;
  color: var(--color-text);
}

.modal-error {
  margin: 0;
  font-size: 0.85rem;
  color: #b3391f;
}

.modal-submit {
  width: 100%;
  justify-content: center;
}

/* ---------- Topbar ---------- */
.topbar {
  background: var(--color-header);
  color: var(--color-header-text);
  font-size: 0.85rem;
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
}

.topbar-links {
  display: flex;
  align-items: center;
  gap: 18px;
}

.icon-btn {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  line-height: 0;
}

.icon-btn img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}

/* ---------- Masthead ---------- */
.masthead {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.masthead-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 20px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 50%;
}

.brand-title {
  display: block;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--color-header);
}

.brand-subtitle {
  display: block;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 600;
}

.subscribe {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 16px;
}

.subscribe-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.subscribe-copy {
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.subscribe-copy strong {
  color: var(--color-text);
  font-size: 0.9rem;
}

.subscribe-input {
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
  min-width: 160px;
}

/* ---------- Main nav ---------- */
.mainnav {
  background: var(--color-nav);
}

.mainnav-row {
  display: flex;
  overflow-x: auto;
}

.mainnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--color-nav-text);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 14px 18px;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.mainnav-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.mainnav-item--active {
  color: #fff;
  border-bottom-color: var(--color-accent);
}

.mainnav-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}

/* ---------- Hero row ---------- */
.hero-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin: 28px 0;
  align-items: stretch;
}

.hero-panel {
  position: relative;
  background: var(--color-header);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 32px;
  overflow: hidden;
  min-height: 380px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-badge {
  display: inline-block;
  background: var(--color-accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 4px 12px;
  border-radius: 999px;
  width: fit-content;
  margin-bottom: 16px;
}

.hero-title {
  font-size: 2rem;
  line-height: 1.2;
  margin: 0 0 14px;
  max-width: 60%;
}

.hero-excerpt {
  max-width: 55%;
  color: rgba(243, 236, 216, 0.85);
  margin: 0 0 20px;
}

.hero-media {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 48%;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.9;
  -webkit-mask-image: linear-gradient(to right, transparent, black 25%);
  mask-image: linear-gradient(to right, transparent, black 25%);
}

.hero-dots {
  display: flex;
  gap: 8px;
  margin-top: 24px;
}

.hero-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}

.hero-dot--active {
  background: var(--color-accent);
}

.ticker-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.panel-title {
  margin: 0 0 16px;
  font-size: 1.1rem;
}

.ticker-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  flex: 1;
}

.ticker-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
}

.ticker-item:last-child {
  border-bottom: none;
}

.ticker-time {
  color: var(--color-accent);
  font-weight: 700;
  flex-shrink: 0;
  width: 60px;
}

.ticker-link:hover {
  text-decoration: underline;
}

/* ---------- Sections ---------- */
.section {
  margin: 40px 0;
}

.section-title {
  font-size: 1.3rem;
  margin: 0 0 18px;
}

.admin-state {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
}

.admin-state h1 {
  margin: 0 0 12px;
  font-size: 1.6rem;
}

.admin-state p {
  color: var(--color-text-muted);
  margin: 0 0 16px;
}

.admin-state p:last-child {
  margin-bottom: 0;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.news-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.news-card-media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.news-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.news-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
}

.news-card-category {
  color: var(--color-accent);
  font-weight: 700;
  text-transform: uppercase;
}

.news-card-time {
  color: var(--color-text-muted);
}

.news-card-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
}

.news-card-title a:hover {
  text-decoration: underline;
}

.news-card-excerpt {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  flex: 1;
}

.news-card-link {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-olive);
}

/* ---------- Categories ---------- */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.category-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.category-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.category-title {
  margin: 0;
  font-size: 1.05rem;
}

.category-desc {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  flex: 1;
}

.category-link {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-accent);
}

.footer-promo {
  background: var(--color-header);
  color: var(--color-header-text);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.footer-promo-image {
  width: 90px;
  height: 90px;
  object-fit: contain;
  flex-shrink: 0;
}

.footer-promo-body p {
  margin: 0 0 14px;
  font-weight: 600;
}

/* ---------- Skeletons ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--color-border) 25%, #f2ead2 37%, var(--color-border) 63%);
  background-size: 400% 100%;
  animation: skeleton-shine 1.4s ease infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-shine {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

.skeleton--hero { min-height: 320px; }
.skeleton--ticker { min-height: 320px; }
.skeleton--grid { min-height: 220px; grid-column: 1 / -1; }
.skeleton--promo { min-height: 90px; }

.block-error {
  grid-column: 1 / -1;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 20px;
}

/* ---------- Footer ---------- */
.sitefooter {
  background: var(--color-header);
  color: var(--color-header-text);
  margin-top: 40px;
}

.sitefooter-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr 1.2fr;
  gap: 24px;
  padding: 40px 20px;
}

.brand--footer .brand-title,
.brand--footer .brand-subtitle {
  color: var(--color-header-text);
}

.sitefooter-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.9rem;
}

.sitefooter-col h5 {
  margin: 0 0 4px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-accent);
}

.sitefooter-col a {
  color: rgba(243, 236, 216, 0.85);
}

.sitefooter-col a:hover {
  color: #fff;
}

.sitefooter-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  font-size: 0.8rem;
  color: rgba(243, 236, 216, 0.7);
  text-align: right;
}

.sitefooter-social {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.sitefooter-social img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero-row {
    grid-template-columns: 1fr;
  }
  .hero-media {
    display: none;
  }
  .hero-title,
  .hero-excerpt {
    max-width: 100%;
  }
  .news-grid,
  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .sitefooter-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .masthead-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .subscribe {
    width: 100%;
  }
  .news-grid,
  .categories-grid {
    grid-template-columns: 1fr;
  }
  .sitefooter-row {
    grid-template-columns: 1fr;
  }
}
