/*
Theme Name: Juha Joutsenlahti 2026
Theme URI: https://juhajoutsenlahti.fi/
Author: Juha Joutsenlahti
Description: Saavutettava, responsiivinen tieto- ja blogisivusto.
Version: 1.0.0
Requires at least: 6.5
Requires PHP: 8.0
Text Domain: juha-joutsenlahti
*/

:root {
  --ink: #142831;
  --navy: #163f52;
  --navy-deep: #0c2d3b;
  --cream: #f5f0e8;
  --paper: #fffdf9;
  --white: #ffffff;
  --clay: #b24e33;
  --clay-soft: #e9a085;
  --sky: #cde2e9;
  --line: rgba(20, 40, 49, 0.18);
  --muted: #54656c;
  --max: 1240px;
  --radius: 1.45rem;
  --shadow: 0 28px 70px rgba(12, 45, 59, 0.13);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 7rem;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

.admin-bar .site-header { top: 32px; }

img { display: block; max-width: 100%; }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

:focus-visible {
  outline: 3px solid #f3b037;
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.7rem 1rem;
  color: var(--white);
  background: var(--navy-deep);
  border-radius: 0.5rem;
  transform: translateY(-180%);
}
.skip-link:focus { transform: translateY(0); }

.preview-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 2.5rem;
  padding: 0.4rem 1rem;
  color: var(--white);
  background: var(--navy-deep);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}
.preview-note span {
  padding: 0.1rem 0.55rem;
  color: var(--navy-deep);
  background: #f3b037;
  border-radius: 999px;
  font-weight: 800;
  text-transform: uppercase;
}
.preview-note p { margin: 0; }

.site-header {
  position: sticky;
  z-index: 30;
  top: 0;
  border-bottom: 1px solid rgba(20, 40, 49, 0.09);
  background: rgba(255, 253, 249, 0.94);
  backdrop-filter: blur(16px);
}
.header-inner {
  display: flex;
  min-height: 6rem;
  width: min(calc(100% - 3rem), var(--max));
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  color: var(--navy-deep);
  text-decoration: none;
  line-height: 1;
}
.brand-first {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.55rem, 2.2vw, 2rem);
  font-style: italic;
}
.brand-last {
  font-size: clamp(0.95rem, 1.4vw, 1.15rem);
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.main-navigation { display: flex; align-items: center; gap: clamp(1rem, 2.3vw, 2.4rem); }
.main-navigation a {
  position: relative;
  color: var(--ink);
  font-size: 0.93rem;
  font-weight: 750;
  text-decoration: none;
}
.main-navigation a::after {
  position: absolute;
  right: 0;
  bottom: -0.55rem;
  left: 0;
  height: 3px;
  background: var(--clay);
  content: "";
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 180ms ease;
}
.main-navigation a:hover::after,
.main-navigation a:focus-visible::after { transform: scaleX(1); transform-origin: left; }
.menu-button { display: none; }

.hero {
  display: grid;
  min-height: calc(100vh - 8.5rem);
  grid-template-columns: minmax(0, 1.03fr) minmax(360px, 0.97fr);
  gap: clamp(3rem, 7vw, 7.5rem);
  width: min(calc(100% - 3rem), var(--max));
  margin: 0 auto;
  padding: clamp(4rem, 8vw, 8rem) 0 clamp(4.5rem, 8vw, 7rem);
  align-items: center;
}
.eyebrow {
  margin: 0 0 1rem;
  color: var(--clay);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.hero h1,
.section h2 {
  margin: 0;
  color: var(--navy-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: -0.052em;
}
.hero h1 { font-size: clamp(4rem, 8.8vw, 8.8rem); }
.hero-lead {
  max-width: 38rem;
  margin: 2.2rem 0 0;
  color: #334b55;
  font-size: clamp(1.14rem, 2vw, 1.45rem);
  line-height: 1.55;
}
.hero-actions { display: flex; margin-top: 2.3rem; align-items: center; gap: 1.6rem; flex-wrap: wrap; }
.button {
  display: inline-flex;
  min-height: 3.25rem;
  padding: 0.75rem 1.35rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 800;
  text-decoration: none;
}
.button-primary { color: var(--white); background: var(--navy); box-shadow: 0 12px 28px rgba(22, 63, 82, 0.2); }
.button-primary:hover { background: var(--navy-deep); }
.text-link { color: var(--navy-deep); font-weight: 800; text-underline-offset: 0.35rem; }
.hero-portrait { margin: 0; }
.portrait-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1.08;
  border-radius: 48% 48% var(--radius) var(--radius);
  background: var(--sky);
  box-shadow: var(--shadow);
}
.portrait-frame::before {
  position: absolute;
  z-index: 2;
  top: 1.2rem;
  right: 1.2rem;
  width: 4.25rem;
  aspect-ratio: 1;
  border: 1px solid rgba(255,255,255,0.72);
  border-radius: 50%;
  content: "";
}
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.hero-portrait figcaption {
  max-width: 33rem;
  margin: 1.25rem 0 0 auto;
  color: var(--muted);
  font-size: 0.92rem;
}

.section { padding: clamp(5rem, 9vw, 9rem) max(1.5rem, calc((100% - var(--max)) / 2)); }
.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(18rem, 0.55fr);
  gap: 3rem;
  margin-bottom: clamp(2.7rem, 6vw, 5rem);
  align-items: end;
}
.section h2 { font-size: clamp(3.4rem, 7.5vw, 7.5rem); }
.section-intro { max-width: 32rem; margin: 0 0 0.6rem; color: var(--muted); font-size: 1.06rem; }

.writing-section { background: var(--cream); }
.topic-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1rem, 2.2vw, 1.8rem); }
.topic-card {
  overflow: hidden;
  border: 1px solid rgba(20,40,49,0.08);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 14px 40px rgba(20,40,49,0.07);
}
.topic-visual { position: relative; overflow: hidden; aspect-ratio: 1.5 / 1; }
.visual-safety { background: var(--navy); }
.rings { position: absolute; inset: 14%; border: 2px solid var(--clay-soft); border-radius: 50%; }
.rings::before, .rings::after { position: absolute; border: 2px solid rgba(255,255,255,.68); border-radius: 50%; content: ""; }
.rings::before { inset: 16%; }
.rings::after { inset: 34%; }
.dot { position: absolute; top: calc(50% - 0.65rem); left: calc(50% - 0.65rem); width: 1.3rem; height: 1.3rem; border-radius: 50%; background: #f3b037; }
.visual-environment { background: #d8e6d2; }
.leaf { position: absolute; display: block; width: 34%; height: 54%; border-radius: 100% 0 100% 0; background: #2e665b; transform: rotate(-18deg); }
.leaf-one { bottom: 17%; left: 22%; }
.leaf-two { right: 18%; bottom: 28%; transform: scale(.75) rotate(68deg); background: var(--clay); }
.leaf-stem { position: absolute; bottom: 8%; left: 49%; width: 3px; height: 72%; background: var(--navy); transform: rotate(28deg); transform-origin: bottom; }
.visual-education { background: #ead6c5; }
.book { position: absolute; top: 24%; width: 36%; height: 53%; border: 3px solid var(--navy); background: var(--paper); }
.book-left { right: 50%; border-radius: .5rem 0 0 .5rem; transform: skewY(7deg); }
.book-right { left: 50%; border-radius: 0 .5rem .5rem 0; transform: skewY(-7deg); }
.book-line { position: absolute; top: 24%; bottom: 20%; left: calc(50% - 1px); width: 2px; background: var(--clay); }
.topic-content { padding: 1.5rem 1.5rem 1.8rem; }
.meta { display: flex; margin: 0 0 0.85rem; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: 0.73rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.topic-content h3 { margin: 0 0 0.65rem; color: var(--navy-deep); font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.65rem, 2.6vw, 2.2rem); font-weight: 400; line-height: 1.08; }
.topic-content > p:last-child { margin: 0; color: var(--muted); }
.card-link { display: inline-flex; margin-top: 1.2rem; align-items: center; gap: .45rem; color: var(--navy-deep); font-size: .9rem; font-weight: 850; text-underline-offset: .28rem; }
.topic-card-empty { display: grid; min-height: 18rem; grid-template-columns: .38fr 1fr; align-items: center; border: 2px dashed rgba(20,40,49,.22); background: transparent; box-shadow: none; }
.empty-symbol { display: grid; width: 4.5rem; aspect-ratio: 1; margin-left: 1.5rem; place-items: center; border: 1px solid rgba(20,40,49,.24); border-radius: 50%; color: var(--clay); font-family: Georgia, "Times New Roman", serif; font-size: 2.5rem; }
.editorial-note { max-width: 49rem; margin-top: 2rem; padding-left: 1rem; border-left: 3px solid var(--clay); color: var(--muted); font-size: 0.9rem; }
.editorial-note p { margin: 0; }

.about-section { display: grid; grid-template-columns: minmax(11rem, 0.36fr) minmax(0, 1fr); gap: clamp(3rem, 9vw, 9rem); background: var(--paper); }
.about-label { display: flex; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--line); padding-top: 1.1rem; }
.about-label span { color: var(--muted); font-size: 0.8rem; }
.about-copy h2 { max-width: 58rem; font-size: clamp(3rem, 6.4vw, 6.7rem); }
.about-lead { max-width: 57rem; margin: 2.3rem 0 0; color: #304851; font-size: clamp(1.2rem, 2vw, 1.55rem); line-height: 1.55; }
.about-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem; margin-top: 2.1rem; }
.about-columns p { margin: 0; color: var(--muted); }

.roles-section { color: var(--white); background: var(--navy-deep); }
.section-heading-light h2, .section-heading-light .section-intro { color: var(--white); }
.section-heading-light .eyebrow { color: var(--clay-soft); }
.role-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid rgba(255,255,255,.24); border-left: 1px solid rgba(255,255,255,.24); }
.role-card { position: relative; min-height: 16rem; padding: clamp(1.8rem, 4vw, 3.2rem); border-right: 1px solid rgba(255,255,255,.24); border-bottom: 1px solid rgba(255,255,255,.24); }
.role-number { color: var(--clay-soft); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.1em; }
.role-card h3 { max-width: 26rem; margin: 2.8rem 0 0.7rem; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.8rem, 3.2vw, 2.75rem); font-weight: 400; line-height: 1.05; }
.role-card p { max-width: 28rem; margin: 0; color: rgba(255,255,255,.75); }

.contact-section { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3rem; align-items: center; background: #dbe8eb; }
.contact-copy h2 { font-size: clamp(3.6rem, 8.5vw, 8.5rem); }
.contact-copy > p:not(.eyebrow) { max-width: 34rem; margin: 1.6rem 0; color: var(--muted); font-size: 1.1rem; }
.email-link { display: inline-flex; align-items: center; gap: 0.7rem; color: var(--navy-deep); font-size: clamp(1rem, 2vw, 1.35rem); font-weight: 850; text-underline-offset: 0.35rem; overflow-wrap: anywhere; }
.contact-mark { display: grid; width: clamp(10rem, 18vw, 15rem); aspect-ratio: 1; place-items: center; border-radius: 50%; color: var(--white); background: var(--clay); font-family: Georgia, "Times New Roman", serif; font-size: clamp(3rem, 7vw, 6rem); letter-spacing: -0.08em; }

.site-footer {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 3rem;
  padding: 3rem max(1.5rem, calc((100% - var(--max)) / 2));
  align-items: end;
  color: rgba(255,255,255,.8);
  background: #071f2a;
  font-size: 0.86rem;
}
.footer-brand p, .footer-sources p { margin: 0; color: var(--white); font-weight: 800; }
.footer-brand span { color: rgba(255,255,255,.58); }
.footer-sources ul { display: flex; margin: 0.4rem 0 0; padding: 0; gap: 1rem; flex-wrap: wrap; list-style: none; }
.footer-sources a { text-underline-offset: 0.25rem; }
.copyright { margin: 0; color: rgba(255,255,255,.58); white-space: nowrap; }

.post-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1rem, 2.2vw, 1.8rem); }
.post-card { overflow: hidden; border: 1px solid rgba(20,40,49,.08); border-radius: var(--radius); background: var(--white); box-shadow: 0 14px 40px rgba(20,40,49,.07); }
.post-card-media { display: block; overflow: hidden; aspect-ratio: 1.5 / 1; background: var(--sky); }
.post-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 240ms ease; }
.post-card-media:hover img { transform: scale(1.025); }
.post-card-body { padding: 1.5rem 1.5rem 1.8rem; }
.post-card h2, .post-card h3 { margin: 0 0 .7rem; color: var(--navy-deep); font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.65rem,2.6vw,2.2rem); font-weight: 400; line-height: 1.08; letter-spacing: -.025em; }
.post-card h2 a, .post-card h3 a { text-decoration: none; }
.post-card h2 a:hover, .post-card h3 a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .2em; }
.post-card .excerpt { margin: 0; color: var(--muted); }
.posts-empty { padding: 2rem; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.pagination { margin-top: 3rem; }
.nav-links { display: flex; gap: .6rem; flex-wrap: wrap; }
.page-numbers { display: grid; min-width: 2.7rem; min-height: 2.7rem; padding: .4rem .7rem; place-items: center; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; }
.page-numbers.current { color: var(--white); background: var(--navy); border-color: var(--navy); }
.article-shell { width: min(calc(100% - 3rem), 840px); margin: 0 auto; padding: clamp(4rem,8vw,8rem) 0; }
.article-header .eyebrow a { color: inherit; }
.article-header h1 { margin: 0; color: var(--navy-deep); font-family: Georgia,"Times New Roman",serif; font-size: clamp(3rem,7vw,6.5rem); font-weight: 400; line-height: .98; letter-spacing: -.045em; }
.article-meta { margin-top: 1.4rem; color: var(--muted); }
.article-featured { overflow: hidden; margin: 2.5rem 0; border-radius: var(--radius); }
.article-content { font-size: 1.1rem; }
.article-content > * { max-width: 100%; }
.article-content h2, .article-content h3 { margin: 2.2em 0 .7em; color: var(--navy-deep); font-family: Georgia,"Times New Roman",serif; line-height: 1.15; }
.article-content a { color: var(--navy); text-underline-offset: .2em; }
.article-content blockquote { margin: 2rem 0; padding: .5rem 0 .5rem 1.5rem; border-left: 4px solid var(--clay); color: var(--muted); font-family: Georgia,"Times New Roman",serif; font-size: 1.35rem; }
.back-link { display: inline-flex; margin-top: 3rem; font-weight: 800; text-underline-offset: .3rem; }

@media (max-width: 900px) {
  .admin-bar .site-header { top: 46px; }
  .header-inner { min-height: 5rem; }
  .menu-button { display: inline-flex; min-height: 2.8rem; padding: 0.55rem 0.8rem; align-items: center; gap: 0.7rem; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: transparent; font: inherit; font-size: 0.86rem; font-weight: 800; }
  .menu-icon { display: grid; width: 1.1rem; gap: 0.32rem; }
  .menu-icon i { display: block; height: 2px; background: currentColor; transition: transform 180ms ease; }
  .menu-button[aria-expanded="true"] .menu-icon i:first-child { transform: translateY(3px) rotate(45deg); }
  .menu-button[aria-expanded="true"] .menu-icon i:last-child { transform: translateY(-3px) rotate(-45deg); }
  .main-navigation { position: absolute; top: 100%; right: 0; left: 0; display: none; padding: 1rem 1.5rem 1.4rem; flex-direction: column; align-items: stretch; gap: 0; border-bottom: 1px solid var(--line); background: var(--paper); box-shadow: 0 18px 30px rgba(20,40,49,.09); }
  .main-navigation.is-open { display: flex; }
  .main-navigation a { min-height: 3.25rem; display: flex; align-items: center; border-bottom: 1px solid var(--line); }
  .main-navigation a::after { display: none; }
  .hero { min-height: auto; grid-template-columns: 1fr; gap: 3.5rem; }
  .hero-copy { max-width: 47rem; }
  .hero-portrait { max-width: 36rem; }
  .section-heading { grid-template-columns: 1fr; gap: 1.5rem; }
  .topic-grid { grid-template-columns: 1fr; }
  .post-grid { grid-template-columns: 1fr 1fr; }
  .topic-card { display: grid; grid-template-columns: minmax(15rem, .78fr) 1fr; }
  .topic-card-empty { grid-template-columns: 8rem 1fr; }
  .topic-visual { min-height: 15rem; aspect-ratio: auto; }
  .about-section { grid-template-columns: 1fr; gap: 2.5rem; }
  .about-label { max-width: 18rem; }
  .site-footer { grid-template-columns: 1fr 1fr; }
  .copyright { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  html { scroll-padding-top: 5.5rem; }
  .preview-note { align-items: flex-start; gap: .5rem; flex-direction: column; }
  .preview-note p { line-height: 1.3; }
  .header-inner, .hero { width: min(calc(100% - 2rem), var(--max)); }
  .brand { gap: .3rem; }
  .brand-first { font-size: 1.4rem; }
  .brand-last { font-size: .84rem; }
  .menu-label { position: absolute; overflow: hidden; width: 1px; height: 1px; clip: rect(0,0,0,0); white-space: nowrap; }
  .menu-button { width: 2.8rem; justify-content: center; }
  .hero { padding-top: 3.5rem; }
  .hero h1 { font-size: clamp(3.4rem, 19vw, 5.3rem); }
  .hero-lead { margin-top: 1.6rem; }
  .hero-actions { align-items: flex-start; flex-direction: column; }
  .portrait-frame { aspect-ratio: 1 / 1.04; }
  .section { padding-right: 1rem; padding-left: 1rem; }
  .section h2 { font-size: clamp(3rem, 17vw, 4.9rem); }
  .topic-card { display: block; }
  .post-grid { grid-template-columns: 1fr; }
  .topic-card-empty { display: grid; grid-template-columns: 6rem 1fr; }
  .topic-card-empty .topic-content { padding-left: .5rem; }
  .empty-symbol { width: 3.5rem; margin-left: 1rem; font-size: 2rem; }
  .topic-visual { min-height: 0; aspect-ratio: 1.55 / 1; }
  .meta { align-items: flex-start; flex-direction: column; gap: .2rem; }
  .about-copy h2 { font-size: clamp(2.7rem, 14vw, 4.5rem); }
  .about-columns, .role-grid { grid-template-columns: 1fr; }
  .role-card { min-height: 13rem; }
  .contact-section { grid-template-columns: 1fr; }
  .contact-mark { width: 8rem; }
  .site-footer { grid-template-columns: 1fr; gap: 2rem; }
  .copyright { grid-column: auto; }
}

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

@media print {
  .preview-note, .site-header, .hero-actions { display: none; }
  body { color: #000; background: #fff; }
  .section, .hero { padding: 2rem 0; }
  .roles-section { color: #000; background: #fff; }
  .section-heading-light h2, .section-heading-light .section-intro, .role-card p { color: #000; }
}
