/* =========================================================
   UNIQUE EDITORIAL UI — redesigned without changing markup
   Palette: ink navy + warm ivory + coral + teal
   ========================================================= */
:root {
  --bg-primary: #f5f2ea;
  --bg-secondary: #0f2430;
  --bg-surface: #ffffff;
  --bg-soft: #e9f0ee;
  --bg-warm: #fff5eb;
  --border-color: #d8dedb;

  /* Existing variable names kept for compatibility */
  --accent-emerald: #e76f51;
  --accent-emerald-hover: #c9553a;

  --accent-secondary: #2a7f7b;
  --accent-secondary-dark: #1f625f;
  --text-main: #15252d;
  --text-muted: #56666d;
  --text-on-dark: #f8fbfa;

  --shadow-sm: 0 6px 18px rgba(15, 36, 48, 0.07);
  --shadow-md: 0 14px 34px rgba(15, 36, 48, 0.11);
  --shadow-lg: 0 22px 58px rgba(15, 36, 48, 0.15);

  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;

  --font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --header-height: 76px;
  --content-width: 1040px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 6%, rgba(42, 127, 123, 0.09), transparent 24rem),
    radial-gradient(circle at 94% 28%, rgba(231, 111, 81, 0.08), transparent 22rem),
    linear-gradient(180deg, #fbfaf6 0%, var(--bg-primary) 34%, #f8f5ee 100%);
}

::selection {
  background: rgba(231, 111, 81, 0.22);
  color: var(--text-main);
}

/* Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  background: rgba(15, 36, 48, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 26px rgba(15, 36, 48, 0.12);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-emerald), var(--accent-secondary), transparent);
  opacity: 0.9;
}

.header-container {
  max-width: 1240px;
  height: 100%;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.logo-link {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.site-logo {
  width: 142px;
  height: 58px;
  object-fit: contain;
  display: block;
}

.logo-img {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-family);
  font-size: 1.3rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #ffffff;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
  transition: transform 0.25s ease, color 0.25s ease;
}

.logo-img::before {
  content: "";
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  border-radius: 3px 50% 50% 50%;
  background: linear-gradient(135deg, var(--accent-emerald), #f4a261);
  transform: rotate(45deg);
  box-shadow: 0 0 0 5px rgba(231, 111, 81, 0.12);
}

.logo-img:hover {
  color: #ffd8cb;
  transform: translateY(-1px);
}

.burger-btn {
  width: 44px;
  height: 44px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  cursor: pointer;
  z-index: 1001;
  transition: background 0.2s ease, transform 0.2s ease;
}

.burger-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.burger-btn:active {
  transform: scale(0.96);
}

.burger-bar {
  width: 100%;
  height: 2px;
  background: #ffffff;
  border-radius: 99px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.burger-btn.is-active .burger-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger-btn.is-active .burger-bar:nth-child(2) { opacity: 0; }
.burger-btn.is-active .burger-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.primary-nav {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: 100%;
  height: calc(100vh - var(--header-height));
  padding: 1.5rem;
  background:
    linear-gradient(rgba(15, 36, 48, 0.98), rgba(15, 36, 48, 0.98)),
    radial-gradient(circle at 80% 0%, rgba(231, 111, 81, 0.15), transparent 22rem);
  transform: translateX(-105%);
  transition: transform 0.32s cubic-bezier(.22, .61, .36, 1);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
}

.primary-nav.is-active { transform: translateX(0); }

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.nav-link {
  position: relative;
  display: block;
  padding: 0.8rem 0.9rem;
  color: rgba(255, 255, 255, 0.86);
  text-decoration: none;
  font-size: 1.04rem;
  font-weight: 700;
  border-radius: 10px;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(3px);
  outline: none;
}

/* Main layout */
.main-container {
  width: min(100%, var(--content-width));
  margin: 0 auto;
  padding: clamp(1.35rem, 4vw, 3.5rem) 1rem 4rem;
  flex: 1;
}

.article {
  position: relative;
}

.article h1 {
  max-width: 900px;
  margin: 0 0 1.35rem;
  font-size: clamp(2rem, 6vw, 3.65rem);
  font-weight: 900;
  line-height: 1.06;
  letter-spacing: -0.045em;
  color: var(--text-main);
  text-wrap: balance;
}

.article h1::after {
  content: "";
  display: block;
  width: 86px;
  height: 7px;
  margin-top: 1rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-emerald), #f4a261 55%, var(--accent-secondary));
}

.article h2 {
  position: relative;
  margin: 2.8rem 0 1.05rem;
  padding: 0.9rem 1rem 0.9rem 1.15rem;
  font-size: clamp(1.45rem, 3vw, 1.9rem);
  font-weight: 850;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--text-main);
  background: linear-gradient(90deg, rgba(42, 127, 123, 0.11), rgba(42, 127, 123, 0.025));
  border: 1px solid rgba(42, 127, 123, 0.15);
  border-left: 5px solid var(--accent-secondary);
  border-radius: 0 14px 14px 0;
}

.article h3 {
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.5rem;
  font-size: clamp(1.16rem, 2vw, 1.35rem);
  font-weight: 800;
  line-height: 1.3;
  color: var(--text-main);
  border-bottom: 1px solid rgba(21, 37, 45, 0.12);
}

.article p {
  margin-bottom: 1.25rem;
  font-size: 1.02rem;
  line-height: 1.78;
  color: var(--text-muted);
}

.article p:first-of-type {
  font-size: 1.075rem;
  color: #43565f;
}

.article a:not(.nav-link) {
  color: var(--accent-secondary-dark);
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(42, 127, 123, 0.35);
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.article a:not(.nav-link):hover {
  color: var(--accent-emerald-hover);
  text-decoration-color: currentColor;
}

.article strong {
  color: #213740;
  font-weight: 800;
}

.article img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.8rem auto;
  border-radius: var(--radius-md);
  border: 1px solid rgba(15, 36, 48, 0.08);
  box-shadow: var(--shadow-md);
}

.article ul,
.article ol {
  margin: 0 0 1.4rem;
  padding: 1.15rem 1.25rem 1.15rem 2.8rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(15, 36, 48, 0.08);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.article li {
  margin-bottom: 0.65rem;
  padding-left: 0.2rem;
  line-height: 1.65;
}

.article li:last-child { margin-bottom: 0; }
.article ul li::marker { color: var(--accent-emerald); }
.article ol li::marker { color: var(--accent-secondary); font-weight: 800; }

.article blockquote {
  position: relative;
  margin: 2rem 0;
  padding: 1.4rem 1.4rem 1.4rem 1.6rem;
  color: #31464f;
  background: var(--bg-warm);
  border: 1px solid #f0d5c6;
  border-left: 5px solid var(--accent-emerald);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  box-shadow: var(--shadow-sm);
}

.article hr {
  height: 1px;
  margin: 2.5rem 0;
  border: 0;
  background: linear-gradient(90deg, transparent, rgba(21, 37, 45, 0.22), transparent);
}

/* Tables */
.article table {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 2rem 0;
  overflow-x: auto;
  border-collapse: separate;
  border-spacing: 0;
  background: #ffffff;
  border: 1px solid #dce4e1;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  -webkit-overflow-scrolling: touch;
}

.article table th,
.article table td {
  padding: 1rem 1.05rem;
  text-align: left;
  vertical-align: middle;
}

.article table th {
  background: linear-gradient(135deg, #153642, #0f2933);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.025em;
  white-space: nowrap;
  border-bottom: 0;
}

.article table th:first-child { border-top-left-radius: 16px; }
.article table th:last-child { border-top-right-radius: 16px; }

.article table td {
  min-width: 120px;
  color: #41545d;
  white-space: normal;
  word-break: break-word;
  border-bottom: 1px solid #e8eeeb;
}

.article table tr:nth-child(even) td {
  background: #f8faf8;
}

.article table tbody tr {
  transition: background 0.2s ease, transform 0.2s ease;
}

.article table tbody tr:hover td {
  background: #edf5f2;
}

.article table tr:last-child td { border-bottom: none; }

/* Author block */
.author-block {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  margin-top: 3.5rem;
  padding: 1.6rem;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.98), rgba(238,247,244,0.96));
  border: 1px solid rgba(42, 127, 123, 0.17);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.author-block::before {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  right: -60px;
  top: -70px;
  border-radius: 50%;
  background: rgba(231, 111, 81, 0.12);
}

.author-block::after {
  content: "";
  position: absolute;
  width: 95px;
  height: 95px;
  left: -45px;
  bottom: -45px;
  border-radius: 50%;
  background: rgba(42, 127, 123, 0.12);
}

.author-avatar {
  position: relative;
  z-index: 1;
  width: 92px;
  height: 92px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 24px;
  border: 4px solid #ffffff;
  outline: 2px solid rgba(42, 127, 123, 0.3);
  box-shadow: 0 9px 24px rgba(15, 36, 48, 0.16);
}

.author-header {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.author-name {
  font-size: 1.18rem;
  font-weight: 850;
  color: var(--text-main);
}

.author-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.68rem;
  color: #ffffff;
  background: var(--accent-secondary);
  border-radius: 999px;
  font-size: 0.71rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.055em;
  box-shadow: 0 4px 12px rgba(42, 127, 123, 0.2);
}

.author-bio {
  position: relative;
  z-index: 1;
  max-width: 720px;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-muted);
}

/* Footer */
.site-footer {
  position: relative;
  margin-top: auto;
  padding: 3rem 1rem 1.6rem;
  color: rgba(255, 255, 255, 0.82);
  background:
    radial-gradient(circle at 8% 5%, rgba(231, 111, 81, 0.16), transparent 19rem),
    linear-gradient(145deg, #0d2029, #102f38);
  border-top: 0;
}

.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: min(88%, 960px);
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.32), transparent);
}

.footer-container {
  max-width: var(--content-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.footer-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.35rem;
}

.footer-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.footer-menu a {
  display: inline-block;
  padding: 0.45rem 0.6rem;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 650;
  border-radius: 8px;
  transition: color 0.2s ease, background 0.2s ease;
}

.footer-menu a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.07);
}

.footer-regulators {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  padding: 1.1rem;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
}

.regulator-badge {
  width: 100px;
  height: 40px;
  padding: 5px 8px;
  object-fit: contain;
  display: block;
  background: rgba(255,255,255,0.92);
  border-radius: 8px;
  filter: grayscale(25%);
  opacity: 0.86;
  transition: filter 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.regulator-badge:hover {
  filter: grayscale(0%);
  opacity: 1;
  transform: translateY(-2px);
}

.footer-legal {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.6);
}

/* Back to top */
.back-to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 999;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: linear-gradient(145deg, var(--accent-emerald), #d95d42);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 15px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  box-shadow: 0 10px 28px rgba(201, 85, 58, 0.28);
  transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.back-to-top:hover {
  background: linear-gradient(145deg, var(--accent-emerald-hover), #b94b34);
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(201, 85, 58, 0.34);
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Keyboard accessibility */
a:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(231, 111, 81, 0.45);
  outline-offset: 3px;
}

/* Small mobile */
@media (max-width: 767px) {
  .header-container { padding-inline: 0.9rem; }

  .logo-img {
    max-width: 245px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1.03rem;
    letter-spacing: 0.055em;
  }

  .main-container {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }

  .article h2 {
    margin-top: 2.2rem;
    padding: 0.8rem 0.85rem;
  }

  .article ul,
  .article ol {
    padding: 1rem 1rem 1rem 2.35rem;
  }

  .article table {
    margin-inline: 0;
    border-radius: 14px;
  }

  .article table th,
  .article table td {
    padding: 0.82rem 0.85rem;
    font-size: 0.9rem;
  }

  .author-block {
    border-radius: 20px;
    padding: 1.35rem 1rem;
  }
}

@media (max-width: 380px) {
  .logo-img {
    max-width: 190px;
    font-size: 0.92rem;
  }

  .logo-img::before {
    width: 9px;
    height: 9px;
    flex-basis: 9px;
  }
}

/* Desktop */
@media (min-width: 768px) {
  .burger-btn { display: none; }

  .primary-nav {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    overflow: visible;
    background: transparent;
    box-shadow: none;
    transform: none;
  }

  .nav-list {
    flex-direction: row;
    align-items: center;
    gap: 0.2rem;
  }

  .nav-link {
    padding: 0.55rem 0.72rem;
    font-size: 0.9rem;
    font-weight: 700;
  }

  .nav-link:hover,
  .nav-link:focus-visible {
    transform: translateY(-1px);
  }

  .article p,
  .article ul,
  .article ol,
  .article blockquote {
    max-width: 900px;
  }

  .author-block {
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
    padding: 1.7rem 1.9rem;
    text-align: left;
  }

  .author-header {
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
  }

  .footer-top {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .footer-menu {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.2rem;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
