/* ===========================
   Template 01 — Magazine
=========================== */

* { box-sizing: border-box; }

:root {
  /* colors (light) */
  --bg: #FFF8FB;
  --surface: #FFFFFF;
  --text: #0B1220;
  --text-muted: #6B7280;
  --border-color: #E9E6EB;
  --accent-color: #FF4D6D;

  /* typography */
  --font-family: "Poppins", system-ui, -apple-system, sans-serif;
  --font-size-base: 16px;
  --line-height-base: 1.6;

  /* geometry */
  --border-radius: 18px;
  --container-padding: 20px;

  /* depth */
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.18);

  /* spacing scale */
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4.5rem;

  /* container widths */
  --container-max: 1100px;

  /* transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;

  /* magazine extras */
  --header-height: 56px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #08101A;
    --surface: #0E1A26;
    --text: #F7FBFF;
    --text-muted: #9AA6B2;
    --border-color: #20303D;
    --accent-color: #FF4D6D;
  }
}

/* ===========================
   Base
=========================== */

h1, h2, h3, h4, h5, h6, p { margin: 0; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  background: var(--bg);
  color: var(--text);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

body main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

body > main > .container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.container {
  width: 100%;
  max-width: var(--container-max);
  padding-inline: var(--space-lg);
  padding-block: var(--space-xl);
}

.container-central {
  flex: 1;
  height: 100%;
  min-height: 50vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color var(--transition-fast), opacity var(--transition-fast);
}

a:hover { opacity: 0.85; }

/* ===========================
   Header — centered magazine
=========================== */

header {
  background: var(--surface);
  border-bottom: none;
  padding-block: var(--space-md);
}

.header-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  margin-inline: auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.logo img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.nav-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0;
}

.nav-menu a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--space-xs) var(--space-md);
  border-radius: 100px;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-menu a:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.05);
  opacity: 1;
}

@media (prefers-color-scheme: dark) {
  .nav-menu a:hover {
    background: rgba(255, 255, 255, 0.08);
  }
}

#nav-toggle { display: none; }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}

.hamburger span {
  display: block;
  width: 26px;
  height: 3px;
  background: var(--text);
  border-radius: 3px;
}

/* ===========================
   Articles Grid — magazine
=========================== */

.articles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  margin-block: var(--space-lg);
}

@media (min-width: 768px) {
  .articles-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Hero card — first child spans full width */
.articles-grid .card:first-child {
  grid-column: 1 / -1;
  padding: 0;
  padding-bottom: var(--space-lg);
  border: none;
  border-bottom: 2px solid var(--accent-color);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.articles-grid .card:first-child a {
  display: grid;
  grid-template-columns: minmax(440px, 1.25fr) minmax(0, 1fr);
  gap: var(--space-xl);
  align-items: stretch;
}

.articles-grid .card:first-child .card-image {
  width: 100%;
  height: 100%;
  min-height: 280px;
  aspect-ratio: 16 / 10;
  border-radius: var(--border-radius);
  margin-bottom: 0;
  order: 0;
}

.articles-grid .card:first-child .card-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-md);
}

.articles-grid .card:first-child h3 {
  font-size: 1.75rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.articles-grid .card:first-child p {
  font-size: 1rem;
  -webkit-line-clamp: 4;
}

/* ===========================
   Cards — horizontal, borderless
=========================== */

.card {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  transition: none;
}

.card:hover {
  transform: none;
  box-shadow: none;
}

.card a {
  height: 100%;
  display: flex;
  flex-direction: row;
  gap: var(--space-md);
}

.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.card-image {
  width: 140px;
  height: 100px;
  flex-shrink: 0;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: calc(var(--border-radius) * 0.5);
  margin-bottom: 0;
  order: 2;
}

.card h3 {
  font-size: 1.05rem;
  line-height: 1.3;
  font-weight: 700;
  color: var(--text);
}

.card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  justify-content: start;
  margin-top: auto;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ===========================
   Article Hero — full-bleed
=========================== */

.article-hero {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: none;
  margin-inline: calc(-1 * var(--space-lg));
  margin-top: calc(-1 * var(--space-xl));
  background-color: transparent;
  position: relative;
}

.article-hero h1 {
  text-align: left;
  max-width: 900px;
  margin-inline: 0;
  font-size: 2.5rem;
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-weight: 800;
  padding: var(--space-xl) var(--space-lg) var(--space-md);
  order: 2;
}

.featured-image {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 21 / 9;
  object-fit: cover;
  margin-inline: 0;
  border-radius: 0;
  box-shadow: none;
  order: 1;
}

.article-meta {
  display: flex;
  width: 100%;
  max-width: 100%;
  flex-wrap: wrap;
  gap: var(--space-md);
  justify-content: flex-start;
  align-items: center;
  margin-inline: 0;
  padding: var(--space-sm) var(--space-lg);
  border-bottom: 2px solid var(--accent-color);
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  order: 3;
}

.article-meta .author {
  font-weight: 700;
  color: var(--accent-color);
}

/* ===========================
   Article Content — editorial
=========================== */

[itemprop="articleBody"] {
  line-height: 1.8;
  width: 100%;
  font-size: 1.05rem;
}

[itemprop="articleBody"] h1,
[itemprop="articleBody"] h2,
[itemprop="articleBody"] h3 {
  margin-block: var(--space-2xl) var(--space-md);
  letter-spacing: -0.02em;
}

[itemprop="articleBody"] h2 {
  font-size: 1.6rem;
  padding-bottom: var(--space-xs);
  border-bottom: 2px solid var(--accent-color);
  display: inline-block;
}

[itemprop="articleBody"] p {
  margin-block: var(--space-md);
}

[itemprop="articleBody"] > p:first-of-type {
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--text);
  font-weight: 500;
}

[itemprop="articleBody"] img {
  display: block;
  max-width: min(65%, 700px);
  height: auto;
  margin: var(--space-2xl) auto;
  border-radius: 0;
  box-shadow: none;
}

/* Article Tables */
[itemprop="articleBody"] table {
  width: 100%;
  margin: var(--space-lg) 0;
  border-collapse: collapse;
  border: 1px solid var(--border-color);
  border-radius: 0;
  overflow: hidden;
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

[itemprop="articleBody"] table thead,
[itemprop="articleBody"] table tbody,
[itemprop="articleBody"] table tfoot {
  display: table;
  width: 100%;
  table-layout: fixed;
}

[itemprop="articleBody"] table thead {
  background: var(--accent-color);
  color: #fff;
}

[itemprop="articleBody"] table th,
[itemprop="articleBody"] table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border: 1px solid var(--border-color);
  white-space: normal;
  word-break: break-word;
}

[itemprop="articleBody"] table th {
  font-weight: 700;
  text-align: center;
}

[itemprop="articleBody"] table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}

@media (prefers-color-scheme: dark) {
  [itemprop="articleBody"] table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
  }
}

[itemprop="articleBody"] table tbody tr:hover {
  background: rgba(0, 105, 217, 0.06);
}

@media (max-width: 768px) {
  [itemprop="articleBody"] table {
    font-size: 0.85rem;
  }
  [itemprop="articleBody"] table th,
  [itemprop="articleBody"] table td {
    padding: 0.5rem;
  }
}

/* ===========================
   Breadcrumb — uppercase micro
=========================== */

.breadcrumb {
  list-style: none;
  display: flex;
  gap: var(--space-xs);
  padding: 0;
  margin: 0 0 var(--space-lg) 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.breadcrumb a {
  color: var(--text-muted);
}

.breadcrumb li:last-child {
  font-weight: 700;
  color: var(--accent-color);
}

/* ===========================
   Search Form — underline style
=========================== */

.search-form {
  max-width: 600px;
  margin: 0 auto var(--space-xl);
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-lg) 0;
}

.search-form input {
  flex: 1;
  padding: var(--space-md) 0;
  font-size: 1.2rem;
  border: none;
  border-bottom: 2px solid var(--border-color);
  border-radius: 0;
  background: transparent;
  color: var(--text);
}

.search-form input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: none;
}

.search-form button {
  padding: var(--space-md) var(--space-xl);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 100px;
  cursor: pointer;
  transition: opacity 0.25s ease;
}

.search-form button:hover {
  opacity: 0.85;
}

#results .no-results {
  margin: 0;
  padding: var(--space-md) 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border-color);
}

/* ===========================
   Footer — accent top border
=========================== */

footer {
  text-align: center;
  border-top: 3px solid var(--accent-color);
  background: var(--surface);
  margin-top: var(--space-3xl);
}

footer > .container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-block: var(--space-xl);
}

footer p {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* ===========================
   About Section
=========================== */
.about-section {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-2xl) var(--space-xl);
}
.about-section h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-md);
}
.about-section h2 {
  font-size: 1.15rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-color);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
}
.about-section p {
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: var(--space-sm);
}
.about-section ul {
  margin: var(--space-sm) 0;
  padding-left: var(--space-lg);
}
.about-section li {
  margin-bottom: var(--space-xs);
  line-height: 1.65;
}

/* ===========================
   Comments — single column, accent border
=========================== */

.comments h2 {
  margin-bottom: var(--space-lg);
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.comment {
  background: transparent;
  border: none;
  border-left: 3px solid var(--accent-color);
  border-radius: 0;
  padding: var(--space-sm) var(--space-md);
  box-shadow: none;
}

.comment-header {
  display: flex;
  justify-content: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-xs);
  padding-bottom: 0;
  background-color: transparent !important;
}

.comment-author-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}

.comment-author-link:hover .comment-author {
  text-decoration: underline;
}

.comment-source-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  opacity: 0.9;
}

.comment-author {
  font-weight: 600;
  color: var(--text);
}

.comment-date {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.comment-content {
  color: var(--text);
  line-height: var(--line-height-base);
}

/* ===========================
   Comment CTA — accent banner
=========================== */

.comment-cta-inner {
  background: var(--accent-color);
  border: none;
  border-radius: var(--border-radius);
  padding: var(--space-xl) var(--space-lg);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.comment-cta-text {
  margin: 0;
  font-size: 1.1rem;
  color: #fff;
  font-weight: 600;
}

.comment-cta-button {
  padding: var(--space-sm) var(--space-xl);
  background: #fff;
  color: var(--accent-color);
  border-radius: 100px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.comment-cta-button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  color: var(--accent-color);
}

@media (max-width: 480px) {
  .comment-cta-inner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .comment-cta-button {
    width: 100%;
    text-align: center;
  }
}

/* ===========================
   Auth page — accent top bar
=========================== */

.auth-page {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: none;
  border-top: 4px solid var(--accent-color);
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  padding: var(--space-2xl) var(--space-xl);
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.auth-card-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.auth-title {
  text-align: left;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  margin-top: 0;
  text-align: left;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Form */

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.auth-field label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-field input {
  padding: var(--space-sm) var(--space-md);
  font-size: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--bg);
  color: var(--text);
}

.auth-field input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Error */

.auth-error {
  padding: var(--space-sm) var(--space-md);
  background: rgba(220, 38, 38, 0.08);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.25);
  border-radius: var(--border-radius);
  font-size: 0.9rem;
}

/* Submit */

.auth-submit {
  margin-top: var(--space-sm);
  padding: var(--space-md);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--accent-color);
  color: #fff;
  border: none;
  border-radius: 100px;
  cursor: pointer;
}

/* Divider */

.auth-divider {
  position: relative;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--border-color);
}

.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }

/* Socials */

.auth-socials {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
}

.auth-social {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  background: var(--bg);
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  font-size: 0.85rem;
  transition: background var(--transition-fast);
}

.auth-social img {
  width: 20px;
  height: 20px;
}

.auth-social:hover {
  transform: none;
  background: rgba(0, 0, 0, 0.04);
  box-shadow: none;
  opacity: 1;
}

@media (prefers-color-scheme: dark) {
  .auth-social:hover {
    background: rgba(255, 255, 255, 0.06);
  }
}

/* Loading states */

.auth-submit.is-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
  color: transparent;
}

.auth-submit.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.8s linear infinite;
}

.auth-social.is-loading {
  pointer-events: none;
  opacity: 0.45;
  filter: grayscale(1);
}

.auth-error {
  animation: auth-error-in 0.2s ease-out;
}

@keyframes auth-error-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* ===========================
   Responsive
=========================== */

@media (max-width: 768px) {
  .hamburger { display: flex; }

  .header-inner {
    flex-direction: row;
    justify-content: space-between;
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: calc(var(--space-lg) * 2 + 45px);
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 2px solid var(--accent-color);
    z-index: 40;
  }

  .nav-menu ul {
    flex-direction: column;
    padding: var(--space-lg);
    gap: var(--space-sm);
  }

  #nav-toggle:checked ~ .nav-menu { display: block; }

  .articles-grid {
    grid-template-columns: 1fr;
  }

  .articles-grid .card:first-child {
    grid-column: auto;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--space-lg);
  }

  .articles-grid .card:first-child a {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
  }

  .articles-grid .card:first-child .card-image {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 9;
    object-fit: cover;
  }

  .articles-grid .card:first-child h3 {
    font-size: 1.35rem;
  }

  .articles-grid .card:first-child p {
    -webkit-line-clamp: 3;
  }

  .card a {
    flex-direction: column;
    align-items: stretch;
  }

  .card-image {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    order: 0;
  }

  .article-hero h1 {
    font-size: 1.75rem;
  }

  .featured-image {
    aspect-ratio: 16 / 9;
  }

  [itemprop="articleBody"] img {
    float: none !important;
    max-width: 100%;
    margin: var(--space-lg) 0 !important;
  }

  .search-form {
    flex-direction: column;
  }

  .search-form button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .article-meta {
    flex-direction: column;
    gap: var(--space-xs);
    align-items: flex-start;
  }

  .comment-cta-inner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .comment-cta-button {
    width: 100%;
    text-align: center;
  }
}
