/* ===== Newspaper / Times — dark edition — Konstantin Khait ===== */

:root {
  --bg:         #0f0e0c;
  --bg-raised:  #191713;
  --text:       #e6e0d0;
  --muted:      #7a7468;
  --rule:       #e6e0d0;
  --rule-dim:   #2e2b25;
  --amber:      #c8913a;
  --col-gap:    1.75rem;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: Georgia, 'Times New Roman', Times, serif;
  font-size: 1rem;
  line-height: 1.65;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---- EDITION LINE ---- */
.edition-line {
  border-bottom: 1px solid var(--rule-dim);
  padding: 0.35rem 0;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.edition-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.edition-left  { font-style: italic; }
.edition-right { display: flex; gap: 1.25rem; }
.edition-right a { color: var(--muted); transition: color 0.15s; }
.edition-right a:hover { color: var(--text); }

/* ---- MASTHEAD ---- */
.masthead {
  border-top: 3px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-top: 2px;
  text-align: center;
  padding: 1.1rem 0 0.9rem;
}
.masthead::after {
  content: '';
  display: block;
  border-top: 1px solid var(--rule);
  margin-top: 6px;
}
.masthead-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(2.4rem, 6vw, 5.2rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1;
  color: var(--text);
  text-transform: uppercase;
}
.masthead-rule-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  margin: 0.55rem 0 0.5rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-style: italic;
}
.masthead-rule-row::before,
.masthead-rule-row::after {
  content: '';
  flex: 1;
  max-width: 220px;
  height: 1px;
  background: var(--rule-dim);
}

/* ---- MAINNAV ---- */
.mainnav {
  border-bottom: 3px double var(--rule);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
}
.mainnav-row {
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
  justify-content: center;
}
.mainnav-row::-webkit-scrollbar { display: none; }
.mainnav-item {
  font-family: Georgia, serif;
  font-size: 0.75rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.6rem 1.25rem;
  white-space: nowrap;
  border-right: 1px solid var(--rule-dim);
  transition: color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
}
.mainnav-item:first-of-type { border-left: 1px solid var(--rule-dim); }
.mainnav-item:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.mainnav-item--active { color: var(--text); font-weight: bold; }

/* ---- NAV TOGGLE (hamburger, mobile only) ---- */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--rule-dim);
  color: var(--text);
  font-size: 1.1rem;
  padding: 0.3rem 0.65rem;
  cursor: pointer;
  line-height: 1;
}
.nav-toggle:hover { border-color: var(--text); }

/* ---- SECTION LABEL ---- */
.section-label {
  font-family: Georgia, serif;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
  font-weight: bold;
  border-bottom: 1px solid var(--amber);
  display: inline-block;
  padding-bottom: 1px;
  margin-bottom: 0.6rem;
}

/* ---- HOMEPAGE FRONT PAGE GRID ---- */
.frontpage { padding: 1.5rem 0 0; }
.frontpage-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 0;
  border-bottom: 1px solid var(--rule-dim);
}
.frontpage-lead {
  border-right: 1px solid var(--rule-dim);
  padding: 1.5rem var(--col-gap) 1.5rem 0;
}
.frontpage-sidebar { padding: 1.5rem 0 1.5rem var(--col-gap); }

.lead-inner {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: var(--col-gap);
  align-items: start;
}
.lead-photo { width: 180px; }
.lead-photo img {
  width: 100%;
  border: 1px solid var(--rule-dim);
  filter: grayscale(1) contrast(1.1) brightness(0.9);
}
.lead-photo figcaption {
  font-size: 0.7rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 0.3rem;
  text-align: center;
  border-top: 1px solid var(--rule-dim);
  padding-top: 0.25rem;
}
.lead-headline {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.lead-deck {
  font-style: italic;
  font-size: 1.05rem;
  color: var(--muted);
  margin-bottom: 0.85rem;
  line-height: 1.5;
}
.lead-body p {
  margin-bottom: 0.75rem;
  text-align: justify;
  hyphens: auto;
  font-size: 0.97rem;
}
.lead-body strong { color: var(--text); }

/* Sidebar */
.sidebar-block {
  border-bottom: 1px solid var(--rule-dim);
  padding-bottom: 1.1rem;
  margin-bottom: 1.1rem;
}
.sidebar-block:last-child { border-bottom: none; margin-bottom: 0; }
.sidebar-label {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: bold;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
  margin-bottom: 0.7rem;
  color: var(--text);
}
.sidebar-contact p { font-size: 0.88rem; margin-bottom: 0.35rem; }
.sidebar-contact a { border-bottom: 1px solid var(--rule-dim); transition: border-color 0.15s; }
.sidebar-contact a:hover { border-color: var(--text); }
.sidebar-portrait img {
  width: 100%;
  border: 1px solid var(--rule-dim);
  filter: grayscale(1) brightness(1.1);
}

/* ---- ARTICLE CARDS ---- */
.articles-header {
  font-family: Georgia, serif;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  padding: 0.5rem 0;
  border-bottom: 3px double var(--rule);
  text-align: center;
  font-weight: bold;
}
.articles-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}
.article-card {
  padding: 1.25rem var(--col-gap) 1.25rem 0;
  border-right: 1px solid var(--rule-dim);
  display: flex;
  flex-direction: column;
}
.article-card:last-child { border-right: none; padding-right: 0; }
.article-card:not(:first-child) { padding-left: var(--col-gap); }
.article-illustration {
  width: 100%;
  margin-bottom: 0.8rem;
  border: 1px solid var(--rule-dim);
  overflow: hidden;
}
.article-illustration img {
  width: 100%;
  filter: brightness(0.95);
  display: block;
  transition: filter 0.3s;
}
.article-card:hover .article-illustration img { filter: brightness(1.1); }
.article-headline {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 0.45rem;
  color: var(--text);
}
.article-body {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
  flex: 1;
  margin-bottom: 0.8rem;
  text-align: justify;
  hyphens: auto;
}
.article-link {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: bold;
  color: var(--text);
  border-bottom: 1px solid var(--rule-dim);
  padding-bottom: 1px;
  align-self: flex-start;
  transition: color 0.15s, border-color 0.15s;
}
.article-card:hover .article-link { color: var(--amber); border-color: var(--amber); }

/* ---- APPS PAGE GRID ---- */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem 0;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule-dim);
}
.app-card {
  padding: 0 var(--col-gap) 0 0;
  border-right: 1px solid var(--rule-dim);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.app-card:nth-child(3n) { border-right: none; padding-right: 0; }
.app-card:nth-child(3n+2),
.app-card:nth-child(3n+3) { padding-left: var(--col-gap); }

/* row separator between grid rows */
.app-card:nth-child(n+4) { border-top: 1px solid var(--rule-dim); padding-top: 1.5rem; }

.app-icon {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 0.9rem;
  border: 1px solid var(--rule-dim);
  flex-shrink: 0;
}
.app-icon img { width: 100%; height: 100%; object-fit: cover; }
.app-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 900;
  margin-bottom: 0.35rem;
  color: var(--text);
}
.app-desc {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.6;
  flex: 1;
  margin-bottom: 1rem;
  text-align: justify;
  hyphens: auto;
}
.app-download {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: Georgia, serif;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: bold;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--rule-dim);
  padding: 0.45rem 1rem;
  transition: border-color 0.15s, color 0.15s;
}
.app-download:hover { border-color: var(--amber); color: var(--amber); }
.app-platform {
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  margin-top: 0.4rem;
  font-style: italic;
}

/* ---- CTA ---- */
.cta-block {
  border-top: 3px double var(--rule);
  padding: 2.5rem 0;
  text-align: center;
}
.cta-block h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.15rem, 2.5vw, 1.65rem);
  font-weight: 900;
  margin-bottom: 0.5rem;
  font-style: italic;
  color: var(--text);
}
.cta-block p { color: var(--muted); margin-bottom: 1.2rem; font-size: 0.95rem; }
.cta-btn {
  display: inline-block;
  font-family: Georgia, serif;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: bold;
  color: var(--bg);
  background: var(--text);
  padding: 0.65rem 1.8rem;
  transition: background 0.2s;
}
.cta-btn:hover { background: var(--amber); }

/* ---- SUBPAGE HERO ---- */
.subpage-hero {
  border-bottom: 3px double var(--rule);
  padding: 1.5rem 0;
}
.subpage-hero-inner {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--col-gap);
  align-items: start;
}
.subpage-illustration { border: 1px solid var(--rule-dim); overflow: hidden; }
.subpage-illustration img { width: 100%; filter: brightness(0.95); }
.subpage-hero h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 0.6rem;
  color: var(--text);
}
.subpage-hero .lead {
  font-style: italic;
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ---- SUBPAGE BODY ---- */
.subpage-body { padding: 2rem 0 3rem; }
.subpage-col { max-width: 760px; }
.subpage-body h2 {
  font-family: Georgia, serif;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: bold;
  color: var(--text);
  margin-top: 2rem;
  margin-bottom: 0.65rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule-dim);
}
.subpage-body h2:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.subpage-body p { margin-bottom: 0.85rem; text-align: justify; hyphens: auto; font-size: 0.97rem; }
.subpage-body ul { padding-left: 1.2rem; margin-bottom: 1rem; }
.subpage-body li { margin-bottom: 0.35rem; font-size: 0.97rem; }
.subpage-body a { color: var(--text); border-bottom: 1px solid var(--rule-dim); transition: color 0.15s, border-color 0.15s; }
.subpage-body a:hover { color: var(--amber); border-color: var(--amber); }
.subpage-body strong { color: var(--text); font-weight: bold; }

/* ---- FOOTER ---- */
footer {
  border-top: 3px double var(--rule);
  padding: 1.5rem 0;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}
.footer-name { font-weight: bold; color: var(--text); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }
.footer-links { display: flex; gap: 1.25rem; }
.footer-links a { color: var(--muted); transition: color 0.15s; }
.footer-links a:hover { color: var(--text); }
.footer-copy { font-style: italic; }

/* ---- RESPONSIVE ---- */
@media (max-width: 860px) {
  .frontpage-grid { grid-template-columns: 1fr; }
  .frontpage-lead {
    border-right: none;
    padding-right: 0;
    border-bottom: 1px solid var(--rule-dim);
    padding-bottom: 1.5rem;
  }
  .frontpage-sidebar { padding-left: 0; padding-top: 1.25rem; }
  .sidebar-portrait { display: none; }
  .articles-grid { grid-template-columns: repeat(2, 1fr); }
  .article-card:nth-child(2n) { border-right: none; padding-right: 0; }
  .article-card:nth-child(2n+1) { padding-left: 0; }
  .article-card:nth-child(n+3) { border-top: 1px solid var(--rule-dim); padding-top: 1.5rem; }
  .apps-grid { grid-template-columns: repeat(2, 1fr); }
  /* reset nth-child rules for 2-col */
  .app-card:nth-child(3n)   { border-right: 1px solid var(--rule-dim); padding-right: var(--col-gap); }
  .app-card:nth-child(3n+2),
  .app-card:nth-child(3n+3) { padding-left: 0; }
  .app-card:nth-child(2n)   { border-right: none; padding-right: 0; }
  .app-card:nth-child(2n+1) { padding-left: 0; }
  .app-card:nth-child(2n)   { padding-left: var(--col-gap); }
  .app-card:nth-child(n+3)  { border-top: 1px solid var(--rule-dim); padding-top: 1.5rem; }
  .app-card:nth-child(-n+2) { border-top: none; padding-top: 0; }
}

@media (max-width: 700px) {
  .lead-inner { grid-template-columns: 1fr; }
  .lead-photo { width: 100%; max-width: 200px; }

  .articles-grid { grid-template-columns: 1fr; }
  .article-card {
    border-right: none;
    border-bottom: 1px solid var(--rule-dim);
    padding: 1.25rem 0;
  }
  .article-card:not(:first-child) { padding-left: 0; }
  .article-card:last-child { border-bottom: none; }

  .apps-grid { grid-template-columns: 1fr; }
  .app-card {
    border-right: none !important;
    border-top: 1px solid var(--rule-dim) !important;
    padding: 1.25rem 0 !important;
  }
  .app-card:first-child { border-top: none !important; padding-top: 0 !important; }

  .subpage-hero-inner { grid-template-columns: 1fr; }
  .edition-left { display: none; }
  .footer-row { flex-direction: column; align-items: flex-start; gap: 0.5rem; }

  /* hamburger menu */
  .nav-toggle { display: block; }
  .mainnav-row { justify-content: flex-end; padding: 0.4rem 0; flex-wrap: wrap; }
  .mainnav-item { display: none; border-left: none; border-right: none; }
  .mainnav-item:first-of-type { border-left: none; }
  .mainnav.nav-open .mainnav-item {
    display: flex;
    flex-basis: 100%;
    border-top: 1px solid var(--rule-dim);
    border-bottom: none;
    padding: 0.65rem 0;
    justify-content: center;
  }
  .mainnav.nav-open .mainnav-item:first-of-type { border-top: none; }
}
