/*
Theme Name: Rīga'dayım Editorial
Theme URI: https://rigadayim.com/
Author: rigadayim.com
Description: Gutenberg-ready editorial WordPress theme designed for long-form city stories and visual essays.
Version: 0.3.0
Requires at least: 6.4
Tested up to: 6.7
Requires PHP: 7.4
Text Domain: rigadayim
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/

/*
 * Font integration point
 * ----------------------
 * Angst Regular is self-hosted from the licensed files supplied by the site
 * owner. Garamond Premier Pro and Futura PT retain safe fallback stacks until
 * their webfont use is confirmed.
 */

@font-face {
  font-family: "Angst";
  src: url("assets/fonts/Angst-Normal.woff2") format("woff2"),
       url("assets/fonts/Angst-Normal.woff") format("woff");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --rg-color-ink: #171717;
  --rg-color-paper: #ffffff;
  --rg-color-surface: #ffffff;
  --rg-color-muted: #6f6b63;
  --rg-color-line: rgba(23, 23, 23, 0.18);
  --rg-color-accent: #b4452f;
  --rg-font-display: "Angst", "Arial Narrow", "Helvetica Neue Condensed", Impact, sans-serif;
  --rg-font-lead: "Garamond Premier Pro", "Iowan Old Style", "Baskerville", "Times New Roman", serif;
  --rg-font-body: "Futura PT", Futura, "Avenir Next", Avenir, "Century Gothic", sans-serif;
  --rg-content: 1240px;
  --rg-narrow: 820px;
  --rg-wide: 1480px;
  --rg-gutter: clamp(20px, 4vw, 64px);
  --rg-rule: 1px solid var(--rg-color-line);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--rg-color-paper);
  color: var(--rg-color-ink);
  font-family: var(--rg-font-body);
  font-size: 18px;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.menu-open {
  overflow: hidden;
}

img,
video,
iframe {
  max-width: 100%;
}

img {
  height: auto;
  vertical-align: middle;
}

figure {
  margin: 0;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover,
a:focus-visible {
  color: var(--rg-color-accent);
}

:focus-visible {
  outline: 2px solid var(--rg-color-accent);
  outline-offset: 4px;
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.screen-reader-text:focus {
  top: 12px;
  left: 12px;
  z-index: 100000;
  width: auto;
  height: auto;
  padding: 12px 16px;
  clip: auto;
  background: var(--rg-color-surface);
}

.site-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-main {
  flex: 1;
}

.site-header {
  position: relative;
  z-index: 30;
  border-bottom: var(--rg-rule);
  background: var(--rg-color-surface);
}

.site-header__inner {
  min-height: 86px;
  width: min(100% - (2 * var(--rg-gutter)), var(--rg-wide));
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  position: relative;
}

.site-branding {
  position: absolute;
  top: 50%;
  left: 50%;
  min-width: max-content;
  transform: translate(-50%, -50%);
  text-align: center;
}

.site-title {
  display: inline-block;
  margin: 0;
  font-family: var(--rg-font-display);
  font-size: clamp(27px, 2.2vw, 34px);
  font-style: normal;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.025em;
  text-decoration: none;
  text-transform: uppercase;
}

.site-description {
  display: none;
}

.menu-toggle {
  display: none;
  border: 0;
  padding: 9px 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.menu-toggle__lines,
.menu-toggle__lines::before,
.menu-toggle__lines::after {
  display: inline-block;
  width: 24px;
  height: 1px;
  background: currentColor;
  transition: transform 180ms ease, opacity 180ms ease;
}

.menu-toggle__lines {
  position: relative;
  margin-right: 9px;
  vertical-align: 4px;
}

.menu-toggle__lines::before,
.menu-toggle__lines::after {
  position: absolute;
  left: 0;
  content: "";
}

.menu-toggle__lines::before { top: -7px; }
.menu-toggle__lines::after { top: 7px; }

.menu-toggle[aria-expanded="true"] .menu-toggle__lines { background: transparent; }
.menu-toggle[aria-expanded="true"] .menu-toggle__lines::before { top: 0; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle__lines::after { top: 0; transform: rotate(-45deg); }

.site-navigation {
  grid-column: 1;
  justify-self: start;
  min-width: 0;
}

.site-navigation ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-navigation > ul {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: clamp(18px, 2vw, 32px);
}

.site-navigation > ul > li {
  position: relative;
}

.site-navigation > ul > li > a {
  display: block;
  padding: 34px 0 33px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.17em;
  text-decoration: none;
  text-transform: uppercase;
}

.site-navigation > ul > .current-menu-item > a,
.site-navigation > ul > .current-menu-ancestor > a,
.site-navigation > ul > li > a:hover,
.site-navigation > ul > li > a:focus-visible {
  color: var(--rg-color-accent);
}

.site-navigation .sub-menu {
  position: absolute;
  top: calc(100% - 1px);
  left: -16px;
  z-index: 40;
  width: 220px;
  padding: 8px 0;
  border: var(--rg-rule);
  background: var(--rg-color-surface);
  box-shadow: 0 14px 28px rgba(23, 23, 23, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.site-navigation li:hover > .sub-menu,
.site-navigation li:focus-within > .sub-menu,
.site-navigation li.is-submenu-open > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.site-navigation .sub-menu li {
  position: relative;
}

.site-navigation .sub-menu a {
  display: block;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.site-navigation .sub-menu li:hover > a,
.site-navigation .sub-menu li:focus-within > a,
.site-navigation .sub-menu a:hover,
.site-navigation .sub-menu a:focus-visible {
  background: #eeeeee;
  color: inherit;
}

.site-navigation .sub-menu .sub-menu {
  top: -9px;
  left: 100%;
  width: 240px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  transform: translateX(-6px);
}

.site-navigation .sub-menu li:hover > .sub-menu,
.site-navigation .sub-menu li:focus-within > .sub-menu,
.site-navigation .sub-menu li.is-submenu-open > .sub-menu {
  transform: translateX(0);
}

.header-search {
  grid-column: 2;
  justify-self: end;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
}

.article-header {
  width: min(100% - (2 * var(--rg-gutter)), var(--rg-wide));
  margin: clamp(64px, 10vw, 140px) auto 0;
  text-align: center;
}

.article-kicker,
.archive-kicker {
  margin: 0 0 24px;
  color: var(--rg-color-accent);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.article-kicker a {
  text-decoration: none;
}

.article-title,
.page-title,
.archive-title,
.error-title {
  margin: 0;
  font-family: var(--rg-font-display);
  font-size: clamp(42px, 6vw, 60px);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.article-lead,
.is-style-article-lead {
  max-width: 1000px;
  margin: 60px auto 0;
  font-family: var(--rg-font-lead);
  font-size: clamp(27px, 3.25vw, 36px);
  font-style: italic;
  font-weight: 400;
  line-height: 1.22;
  text-align: center;
}

.article-lead p {
  margin: 0;
}

.article-meta {
  margin-top: 34px;
  color: var(--rg-color-muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 26px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-meta a {
  text-decoration: none;
}

.article-hero {
  width: min(100% - (2 * var(--rg-gutter)), var(--rg-wide));
  margin: clamp(54px, 7vw, 96px) auto clamp(70px, 9vw, 130px);
}

.article-hero img {
  width: 100%;
  max-height: 86vh;
  object-fit: cover;
}

.article-hero figcaption,
.entry-content figcaption,
.wp-caption-text {
  margin-top: 12px;
  color: var(--rg-color-muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: left;
}

.entry-content {
  font-family: var(--rg-font-body);
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 400;
  line-height: 1.25;
}

.entry-content > * {
  width: min(100% - (2 * var(--rg-gutter)), var(--rg-content));
  margin-inline: auto;
}

.entry-content > .alignwide {
  width: min(100% - (2 * var(--rg-gutter)), var(--rg-wide));
  max-width: none;
}

.entry-content > .alignfull {
  width: 100%;
  max-width: none;
}

.entry-content p,
.entry-content ul,
.entry-content ol {
  margin-top: 0;
  margin-bottom: 40px;
}

.entry-content h2,
.entry-content h3,
.entry-content h4 {
  margin-top: clamp(64px, 9vw, 120px);
  margin-bottom: 30px;
}

.entry-content h2 {
  font-family: var(--rg-font-display);
  font-size: clamp(38px, 5vw, 64px);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.entry-content h3 {
  font-size: clamp(27px, 3vw, 38px);
  font-weight: 500;
  line-height: 1.1;
}

.entry-content h4 {
  font-size: 0.9em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.entry-content ul,
.entry-content ol {
  padding-left: 1.25em;
}

.entry-content li + li {
  margin-top: 0.45em;
}

.entry-content a {
  text-decoration-color: var(--rg-color-accent);
}

.entry-content .wp-block-image,
.entry-content .wp-block-gallery,
.entry-content .wp-block-columns,
.entry-content .wp-block-video,
.entry-content .wp-block-embed,
.entry-content .wp-block-cover {
  margin-top: clamp(50px, 7vw, 90px);
  margin-bottom: clamp(50px, 7vw, 90px);
}

.entry-content .wp-block-image img {
  width: 100%;
}

.entry-content .wp-block-columns {
  gap: clamp(24px, 4vw, 64px);
  align-items: flex-start;
}

.entry-content .wp-block-columns p {
  font-size: 0.78em;
  line-height: 1.35;
}

.entry-content blockquote,
.entry-content .wp-block-quote {
  position: relative;
  width: min(100% - (2 * var(--rg-gutter)), 1000px);
  margin-top: clamp(70px, 9vw, 120px);
  margin-bottom: clamp(70px, 9vw, 120px);
  padding: 38px 0 0;
  border: 0;
  border-top: 2px solid currentColor;
  font-family: var(--rg-font-lead);
  font-size: clamp(30px, 4vw, 48px);
  font-style: italic;
  line-height: 1.15;
  text-align: center;
}

.entry-content blockquote p {
  margin-bottom: 18px;
}

.entry-content blockquote cite {
  display: block;
  font-family: var(--rg-font-body);
  font-size: 12px;
  font-style: normal;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.wp-block-embed__wrapper,
.wp-block-video {
  position: relative;
}

.wp-block-embed.is-type-video .wp-block-embed__wrapper {
  aspect-ratio: 16 / 9;
}

.wp-block-embed.is-type-video iframe {
  width: 100%;
  height: 100%;
}

.wp-block-separator {
  border: 0;
  border-top: var(--rg-rule);
  margin-top: 90px;
  margin-bottom: 90px;
}

.article-footer {
  width: min(100% - (2 * var(--rg-gutter)), var(--rg-content));
  margin: clamp(80px, 11vw, 150px) auto 0;
  padding-top: 28px;
  border-top: var(--rg-rule);
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-tags a {
  padding: 8px 12px;
  border: var(--rg-rule);
  text-decoration: none;
}

.post-navigation {
  width: min(100% - (2 * var(--rg-gutter)), var(--rg-wide));
  margin: clamp(80px, 12vw, 170px) auto 0;
  padding-top: 30px;
  border-top: var(--rg-rule);
}

.post-navigation .nav-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px;
}

.post-navigation .nav-next {
  text-align: right;
}

.post-navigation a {
  text-decoration: none;
}

.post-navigation .nav-subtitle {
  display: block;
  margin-bottom: 10px;
  color: var(--rg-color-muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.post-navigation .nav-title {
  font-family: var(--rg-font-display);
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1;
  text-transform: uppercase;
}

.listing-header,
.page-header,
.error-page {
  width: min(100% - (2 * var(--rg-gutter)), var(--rg-wide));
  margin: clamp(64px, 10vw, 140px) auto clamp(56px, 8vw, 100px);
  text-align: center;
}

.archive-description {
  max-width: 720px;
  margin: 28px auto 0;
  color: var(--rg-color-muted);
  font-family: var(--rg-font-lead);
  font-size: 24px;
  font-style: italic;
  line-height: 1.3;
}

.post-grid {
  width: min(100% - (2 * var(--rg-gutter)), var(--rg-wide));
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(48px, 7vw, 100px) clamp(24px, 3vw, 48px);
}

.story-card {
  grid-column: span 6;
}

.story-card:nth-child(3n + 1) {
  grid-column: span 12;
}

.story-card__image {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: rgba(23, 23, 23, 0.08);
}

.story-card:nth-child(3n + 1) .story-card__image {
  aspect-ratio: 16 / 8;
}

.story-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 350ms ease;
}

.story-card__image:hover img {
  transform: scale(1.02);
}

.story-card__category {
  margin: 20px 0 10px;
  color: var(--rg-color-accent);
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.story-card__category a,
.story-card__title a {
  text-decoration: none;
}

.story-card__title {
  margin: 0;
  font-family: var(--rg-font-display);
  font-size: clamp(31px, 4vw, 54px);
  font-weight: 400;
  line-height: 0.98;
  text-transform: uppercase;
}

.story-card__excerpt {
  max-width: 760px;
  margin: 18px 0 0;
  color: var(--rg-color-muted);
  font-family: var(--rg-font-lead);
  font-size: 21px;
  font-style: italic;
  line-height: 1.3;
}

.pagination {
  width: min(100% - (2 * var(--rg-gutter)), var(--rg-wide));
  margin: 90px auto 0;
  padding-top: 28px;
  border-top: var(--rg-rule);
}

.pagination .nav-links {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.pagination .page-numbers {
  min-width: 40px;
  padding: 8px 10px;
  text-align: center;
  text-decoration: none;
}

.pagination .current {
  border: 1px solid currentColor;
}

.page-article .entry-content {
  margin-top: 70px;
}

.error-code {
  margin: 0 0 20px;
  color: var(--rg-color-accent);
  font-family: var(--rg-font-display);
  font-size: clamp(100px, 22vw, 280px);
  line-height: 0.72;
}

.error-copy {
  max-width: 620px;
  margin: 30px auto;
  font-family: var(--rg-font-lead);
  font-size: 25px;
  font-style: italic;
}

.button-link,
.search-submit {
  display: inline-block;
  padding: 13px 18px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font-family: var(--rg-font-body);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
}

.search-form {
  display: flex;
  max-width: 560px;
  margin: 36px auto 0;
}

.search-field {
  min-width: 0;
  flex: 1;
  border: 1px solid currentColor;
  border-right: 0;
  padding: 12px 14px;
  background: var(--rg-color-surface);
  color: inherit;
  font: inherit;
}

.no-results {
  width: min(100% - (2 * var(--rg-gutter)), 760px);
  margin: 100px auto;
  text-align: center;
}

.site-footer {
  margin-top: clamp(100px, 15vw, 220px);
  border-top: var(--rg-rule);
}

.site-footer__inner {
  width: min(100% - (2 * var(--rg-gutter)), var(--rg-wide));
  margin-inline: auto;
  padding: 55px 0 36px;
}

.footer-brand {
  margin: 0 0 48px;
  font-family: var(--rg-font-display);
  font-size: clamp(48px, 10vw, 140px);
  line-height: 0.8;
  letter-spacing: -0.03em;
  text-align: center;
  text-transform: uppercase;
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 22px;
  border-top: var(--rg-rule);
  color: var(--rg-color-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.footer-navigation ul {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-navigation a {
  text-decoration: none;
}

@media (max-width: 1180px) {
  :root {
    --rg-gutter: 20px;
  }

  .site-header__inner {
    min-height: 76px;
    grid-template-columns: 40px 1fr 40px;
    gap: 14px;
  }

  .site-branding {
    position: static;
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    transform: none;
    text-align: center;
  }

  .site-title {
    font-size: 25px;
  }

  .menu-toggle {
    grid-column: 1;
    grid-row: 1;
    display: inline-flex;
    align-items: center;
    justify-self: start;
  }

  .site-description,
  .menu-toggle__label {
    display: none;
  }

  .header-search {
    grid-column: 3;
    grid-row: 1;
    width: 24px;
    height: 24px;
    overflow: hidden;
    color: transparent;
    white-space: nowrap;
  }

  .header-search::before {
    display: block;
    width: 12px;
    height: 12px;
    margin: 3px 0 0 1px;
    border: 1.5px solid var(--rg-color-ink);
    border-radius: 50%;
    box-shadow: 7px 7px 0 -5.5px var(--rg-color-ink);
    content: "";
  }

  .site-navigation {
    position: absolute;
    inset: 100% 0 auto;
    display: none;
    min-height: calc(100vh - 76px);
    max-height: calc(100vh - 76px);
    padding: 28px var(--rg-gutter) 48px;
    overflow: auto;
    border-top: var(--rg-rule);
    border-bottom: var(--rg-rule);
    background: var(--rg-color-surface);
  }

  .site-navigation.is-open {
    display: block;
  }

  .site-navigation > ul {
    display: block;
    text-align: center;
  }

  .site-navigation > ul > li + li {
    margin-top: 18px;
  }

  .site-navigation > ul > li > a {
    padding: 8px 0;
    font-family: var(--rg-font-display);
    font-size: 30px;
    font-weight: 400;
    letter-spacing: 0.02em;
  }

  .site-navigation > ul > li > .sub-menu {
    position: static;
    display: block;
    width: 100%;
    max-height: none;
    margin: 12px 0 26px;
    padding: 22px 0;
    overflow: visible;
    border-top: var(--rg-rule);
    border-bottom: var(--rg-rule);
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .site-navigation .sub-menu .sub-menu {
    position: static;
    width: 100%;
    max-height: none;
    margin: 6px 0 12px;
    padding: 0;
    overflow: visible;
    border: 0;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .site-navigation > ul > li > .sub-menu > li + li {
    margin-top: 8px;
  }

  .site-navigation > ul > li > .sub-menu > li > a,
  .site-navigation .sub-menu .sub-menu a {
    font-size: 12px;
    white-space: normal;
  }

  .site-navigation .sub-menu .sub-menu a {
    padding-block: 8px;
    color: var(--rg-color-muted);
  }

  .article-header {
    margin-top: 62px;
  }

  .article-title,
  .page-title,
  .archive-title,
  .error-title {
    font-size: clamp(39px, 12vw, 54px);
  }

  .article-lead,
  .is-style-article-lead {
    margin-top: 38px;
  }

  .article-meta {
    margin-top: 26px;
  }

  .article-hero {
    width: 100%;
    margin-top: 48px;
    margin-bottom: 64px;
  }

  .article-hero figcaption {
    padding-inline: var(--rg-gutter);
  }

  .entry-content {
    font-size: 20px;
    line-height: 1.35;
  }

  .entry-content p,
  .entry-content ul,
  .entry-content ol {
    margin-bottom: 30px;
  }

  .entry-content .wp-block-columns {
    gap: 34px;
  }

  .entry-content .wp-block-columns p {
    font-size: 1em;
  }

  .post-navigation .nav-links {
    grid-template-columns: 1fr;
  }

  .post-navigation .nav-next {
    text-align: left;
  }

  .post-grid {
    display: block;
  }

  .story-card + .story-card {
    margin-top: 64px;
  }

  .story-card:nth-child(n) .story-card__image {
    aspect-ratio: 4 / 3;
  }

  .story-card__title {
    font-size: 36px;
  }

  .footer-brand {
    font-size: 15vw;
  }

  .footer-row {
    display: block;
    text-align: center;
  }

  .footer-navigation ul {
    justify-content: center;
    margin-bottom: 18px;
  }
}

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