/*
Theme Name: Potilasvahinko
Theme URI: https://potilasvahinko.com
Description: Selkokielinen potilasvahinko- ja potilasturvaopas
Author: Potilasvahinko.com
Version: 1.0
*/

:root {
  --color-bg: #f5f7fb;
  --color-surface: #ffffff;
  --color-primary: #005b8f;
  --color-primary-soft: #e3f2fd;
  --color-accent: #f2b544;
  --color-muted: #6b7280;
  --color-border: #e5e7eb;
  --color-text: #111827;

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;

  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.06);
  --max-width: 72rem;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  font-size: 16px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover,
a:focus {
  text-decoration-thickness: 2px;
}


.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ----------------------------------------------------------
   Header ja päävalikko
---------------------------------------------------------- */

.site-header {
    background-color: #ffffff;
    border-bottom: 1px solid #d9e2f0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.site-header__inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

/* Brändi / logo */

.site-branding {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.site-title-group {
    display: flex;
    flex-direction: column;
}

.site-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: #0f172a;
}

.site-title:hover,
.site-title:focus {
    text-decoration: none;
    color: #0b63ce;
}

.site-description {
    margin: 0;
    font-size: 0.85rem;
    color: #6b7280;
}

/* HEADER */
/*
.site-header {
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  gap: 1rem;
}

.site-logo {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  color: var(--color-primary);
  text-decoration: none;
}

.site-tagline {
  display: block;
  font-size: 0.75rem;
  color: var(--color-muted);
}
*/
/* NAV */

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.95rem;
}

.site-nav a {
  text-decoration: none;
  color: var(--color-text);
  padding: 0.35rem 0.2rem;
  border-radius: 999px;
}

.site-nav a:hover,
.site-nav a:focus {
  background-color: var(--color-primary-soft);
}

/* HERO / PAGE HEADER */

.page-hero {
  background: radial-gradient(circle at top left, #e3f2fd 0, #f5f7fb 45%, #f5f7fb 100%);
  border-bottom: 1px solid var(--color-border);
  padding: 2rem 0 1.5rem;
}

.page-hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.breadcrumb {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-bottom: 0.75rem;
}

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

.breadcrumb a:hover {
  text-decoration: underline;
}

.page-hero-title {
  font-size: clamp(1.6rem, 3vw, 2rem);
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}

.page-hero-intro {
  max-width: 38rem;
  font-size: 0.98rem;
  color: #374151;
}

/* ACTION CARDS (etusivun/yläosan valinnat) */

.action-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.action-card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--color-border);
}

.action-card--primary {
  border-left: 4px solid var(--color-primary);
}

.action-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.action-card-text {
  font-size: 0.9rem;
  color: var(--color-muted);
}

.action-card-link {
  display: inline-flex;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  text-decoration: none;
  color: var(--color-primary);
}

.action-card-link::after {
  content: "→";
  margin-left: 0.35rem;
  font-size: 0.9em;
}

/* LAYOUT */

.site-main {
  padding: 2rem 0 3rem;
}

.content-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

@media (min-width: 960px) {
  .content-layout {
    flex-direction: row;
    align-items: flex-start;
  }

  .content-primary {
    flex: 3 1 0;
    min-width: 0;
  }

  .content-sidebar {
    flex: 1.2 1 0;
    position: sticky;
    top: 1.5rem;
    align-self: flex-start;
  }
}

/* ARTICLE / PAGE */

.entry {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow-soft);
}

.entry-header {
  margin-bottom: 1.25rem;
}

.entry-title {
  font-size: 1.4rem;
  margin: 0 0 0.4rem;
}

.entry-meta {
  font-size: 0.8rem;
  color: var(--color-muted);
}

.entry-content > * + * {
  margin-top: 0.9rem;
}

.entry-content h2 {
  font-size: 1.1rem;
  margin: 1.4rem 0 0.5rem;
}

.entry-content h3 {
  font-size: 1rem;
  margin: 1rem 0 0.5rem;
}

.entry-content p {
  margin: 0 0 15px 0;
}

.entry-content ul,
.entry-content ol {
  padding-left: 1.2rem;
  margin: 0.5rem 0 0;
}

.entry-content li + li {
  margin-top: 0.35rem;
}

/* INFO BOXES */

.info-box {
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  border: 1px solid var(--color-border);
  background-color: #f9fafb;
  font-size: 0.9rem;
}

.info-box--notice {
  border-left: 4px solid var(--color-primary);
  background-color: var(--color-primary-soft);
}

.info-box--warning {
  border-left: 4px solid var(--color-accent);
  background-color: #fffbeb;
}

/* SIDEBAR */

.sidebar-block {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.1rem;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-soft);
}

.sidebar-block + .sidebar-block {
  margin-top: 1rem;
}

.sidebar-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.sidebar-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-links li + li {
  margin-top: 0.35rem;
}

.sidebar-links a {
  text-decoration: none;
  font-size: 0.9rem;
  color: var(--color-primary);
}

.sidebar-links a:hover {
  text-decoration: underline;
}

/* FOOTER */

.site-footer {
  border-top: 1px solid var(--color-border);
  background-color: var(--color-surface);
  padding: 1.5rem 0 2rem;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.site-footer-inner {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
/* Navigaatio - Desktop */
.site-nav {
    display: block;
}
.site-nav__list {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin: 0;
    padding: 0;
}

/* Menu–perus */
.menu-item {
    position: relative;
    list-style: none;
}
.menu-link,
.menu-item > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 500;
    color: #0f172a;
    padding: 0.35rem 0.15rem;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.menu-link:hover,
.menu-link:focus,
.menu-item > a:hover,
.menu-item > a:focus {
    color: #0b63ce;
    text-decoration: none;
}

/* Alasvetovalikko–nuoli */
.menu-item-has-children > .menu-link::after {
    content: "▾";
    font-size: 0.7rem;
    margin-left: 0.35rem;
    transition: transform 0.15s ease;
}

/* Alasvetovalikot */
.sub-menu {
    list-style: none;
    position: absolute;
    left: 0;
    top: 80%;
    min-width: 210px;
    margin: 0.35rem 0 0 0;
    padding: 0.35rem 0;
    background-color: #ffffff;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.15);
    display: none;
    z-index: 1000;
}
.sub-menu li {
    margin: 0;
}
.sub-menu a {
    display: block;
    padding: 0.4rem 0.85rem;
    font-size: 0.9rem;
    color: #0f172a;
    white-space: nowrap;
}
.sub-menu a:hover,
.sub-menu a:focus {
    background-color: #eff6ff;
    color: #0b63ce;
    text-decoration: none;
}

/* Näytä drop-down hoverilla ja näppiksellä */
.menu-item-has-children:hover > .sub-menu,
.menu-item-has-children:focus-within > .sub-menu {
    display: block;
}
.menu-item-has-children:hover > .menu-link::after,
.menu-item-has-children:focus-within > .menu-link::after {
    transform: rotate(180deg);
}

/* Hamburger-nappi (piilotettu desktopilla) */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}
.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #0f172a;
    margin: 5px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

/* Hamburger-animaatio kun auki */
.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}
.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}
.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* MOBILE STYLES */
@media (max-width: 768px) {
    /* Näytä hamburger-nappi */
    .menu-toggle {
        display: block;
    }
    
    /* Sidebar-navigaatio */
    .site-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background-color: #ffffff;
        box-shadow: -4px 0 20px rgba(15, 23, 42, 0.1);
        transition: right 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
    }
    
    /* Kun valikko on auki */
    .site-nav.active {
        right: 0;
    }
    
    /* Overlay tausta */
    .nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: rgba(15, 23, 42, 0.5);
        z-index: 999;
        transition: opacity 0.3s ease;
    }
    .nav-overlay.active {
        display: block;
    }
    
    /* Navigaatio lista */
    .site-nav__list {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 4rem 0 2rem 0;
    }
    
    /* Menu itemit */
    .menu-item {
        border-bottom: 1px solid #f1f5f9;
    }
    
    .menu-link,
    .menu-item > a {
        display: flex;
        justify-content: space-between;
        padding: 1rem 1.5rem;
        font-size: 1rem;
        width: 100%;
    }
    
    /* Alasvetovalikko nuoli mobiilissa */
    .menu-item-has-children > .menu-link::after {
        content: "›";
        font-size: 1.2rem;
        margin-left: auto;
        transform: rotate(0deg);
    }
    
    .menu-item-has-children.active > .menu-link::after {
        transform: rotate(90deg);
    }
    
    /* Submenu mobiilissa */
    .sub-menu {
        position: static;
        width: 100%;
        min-width: auto;
        margin: 0;
        padding: 0;
        background-color: #f8fafc;
        border: none;
        border-radius: 0;
        box-shadow: none;
        display: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .menu-item-has-children.active > .sub-menu {
        display: block;
        max-height: 500px;
    }
    
    .sub-menu a {
        padding: 0.75rem 1.5rem 0.75rem 2.5rem;
        font-size: 0.95rem;
    }
    
    .sub-menu a:hover,
    .sub-menu a:focus {
        background-color: #e0f2fe;
    }
    
    /* Poista hover-efektit mobiilissa */
    .menu-item-has-children:hover > .sub-menu,
    .menu-item-has-children:focus-within > .sub-menu {
        display: none;
    }
    
    .menu-item-has-children.active > .sub-menu {
        display: block;
    }
}

@media (min-width: 768px) {
  .site-footer-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-links a {
  text-decoration: none;
  color: var(--color-muted);
}

.footer-links a:hover {
  text-decoration: underline;
}

