/*
Theme Name:  Kajsten Spanien
Theme URI:   https://spanien.kajsten.se
Description: Spanien-sajt för familjen Kajsten
Author:      Mattias Kajsten
Version:     3.0.0
License:     GNU General Public License v2 or later
Text Domain: kajsten-spanien
*/

:root {
  --k-bg:      #F9F7F4;
  --k-surface: #FFFFFF;
  --k-fg:      #1A1A1A;
  --k-muted:   #6B6B6B;
  --k-border:  rgba(0,0,0,0.10);
  --k-accent:  #8B4513;
  --k-accent-h:#a0521a;
  --k-radius:  4px;
  --k-nav-h:   60px;
  --k-max:     800px;
  --k-font:    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --k-bg:      #141210;
    --k-surface: #1F1C1A;
    --k-fg:      #F0EDEA;
    --k-muted:   #999;
    --k-border:  rgba(255,255,255,0.10);
    --k-accent:  #C4784A;
    --k-accent-h:#d4895b;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { background: var(--k-bg); color: var(--k-fg); font-family: var(--k-font); line-height: 1.7; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* ── NAV ─────────────────────────────────────────────────── */
#k-nav-wrap {
  position: sticky !important;
  top: 0 !important;
  z-index: 9999 !important;
  background: var(--k-bg);
  border-bottom: 0.5px solid var(--k-border);
}
#k-nav {
  height: 60px;
  max-width: 100%;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0 2rem;
  gap: 1rem;
}
#k-logo {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: .04em;
  display: flex !important;
  align-items: center;
  gap: .5rem;
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--k-fg);
  text-decoration: none;
}
#k-logo:hover { opacity: .75; }
#k-logo-sub {
  font-size: 11px;
  color: var(--k-muted);
  letter-spacing: .08em;
  text-transform: uppercase;
}
#k-nav-menu {
  flex: 1;
  display: flex !important;
  align-items: center;
  overflow: hidden;
}
/* The <ul> wp_nav_menu generates */
#k-primary-menu {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
  height: 60px;
}
#k-primary-menu li {
  display: block !important;
  float: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
#k-primary-menu li a {
  display: flex !important;
  align-items: center;
  padding: 0 1rem !important;
  height: 60px !important;
  font-size: 13px !important;
  color: var(--k-muted) !important;
  letter-spacing: .03em;
  text-decoration: none !important;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .15s;
}
#k-primary-menu li a:hover,
#k-primary-menu li.current-menu-item a,
#k-primary-menu li.current_page_item a {
  color: var(--k-fg) !important;
  opacity: 1 !important;
}
#k-primary-menu li.current-menu-item a,
#k-primary-menu li.current_page_item a {
  border-bottom-color: var(--k-accent);
}
#k-logout {
  font-size: 12px;
  padding: 7px 16px;
  border: 0.5px solid var(--k-border);
  color: var(--k-muted);
  text-decoration: none;
  border-radius: var(--k-radius);
  white-space: nowrap;
  flex-shrink: 0;
  transition: color .15s, border-color .15s;
}
#k-logout:hover { color: var(--k-fg); border-color: var(--k-fg); opacity: 1; }
#k-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}
#k-hamburger span { display: block; width: 22px; height: 1.5px; background: var(--k-fg); }
@media (max-width: 700px) {
  #k-primary-menu { display: none !important; }
  #k-hamburger { display: flex !important; }
  #k-primary-menu.open {
    display: flex !important;
    flex-direction: column !important;
    position: absolute;
    top: 60px;
    left: 0; right: 0;
    background: var(--k-bg);
    border-bottom: 0.5px solid var(--k-border);
    height: auto !important;
    padding: 1rem 0 !important;
    z-index: 9998;
  }
  #k-primary-menu.open li a {
    height: auto !important;
    padding: .75rem 2rem !important;
    border-bottom: none !important;
  }
}

/* ── LOGIN PAGE ───────────────────────────────────────────── */
.k-login-page {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  padding: 2rem; background: var(--k-bg);
}
.k-login-card {
  background: var(--k-surface); border: 0.5px solid var(--k-border);
  border-radius: 8px; padding: 3rem 2.5rem;
  width: 100%; max-width: 380px;
}
.k-login-card h2 { font-size: 20px; font-weight: 500; margin-bottom: 2rem; text-align: center; }
.k-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 1rem; }
.k-field label { font-size: 11px; letter-spacing: .08em; color: var(--k-muted); text-transform: uppercase; }
.k-field input {
  height: 42px; border: 0.5px solid var(--k-border);
  background: var(--k-bg); color: var(--k-fg);
  padding: 0 12px; font-size: 14px;
  border-radius: var(--k-radius); font-family: var(--k-font); outline: none;
  transition: border-color .15s;
}
.k-field input:focus { border-color: var(--k-accent); }
.k-login-error { font-size: 13px; color: #b33; margin-bottom: .75rem; display: none; }
.k-login-error.visible { display: block; }
.k-submit-btn {
  width: 100%; height: 42px; background: var(--k-accent); color: #fff;
  border: none; cursor: pointer; font-size: 13px; letter-spacing: .06em;
  border-radius: var(--k-radius); font-family: var(--k-font); margin-top: .5rem;
  transition: background .15s;
}
.k-submit-btn:hover { background: var(--k-accent-h); }

/* ── PAGE LAYOUT ─────────────────────────────────────────── */
.k-page {
  max-width: var(--k-max);
  margin: 0 auto;
  padding: 3.5rem 2rem 5rem;
}
.k-page-header { margin-bottom: 2.5rem; padding-bottom: 1.5rem; border-bottom: 0.5px solid var(--k-border); }
.k-page-header h1 { font-size: clamp(24px,4vw,36px); font-weight: 500; letter-spacing: -.02em; margin-bottom: .35rem; }
.k-page-header .k-subtitle { font-size: 14px; color: var(--k-muted); }

/* ── CONTENT (from WP editor) ────────────────────────────── */
.k-content { font-size: 15px; color: var(--k-muted); line-height: 1.8; }
.k-content h2 { font-size: 17px; font-weight: 500; color: var(--k-fg); margin: 2.5rem 0 .75rem; }
.k-content h3 { font-size: 15px; font-weight: 500; color: var(--k-fg); margin: 1.75rem 0 .5rem; }
.k-content p { margin-bottom: 1rem; }
.k-content ul, .k-content ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.k-content li { margin-bottom: .4rem; }
.k-content strong { color: var(--k-fg); font-weight: 500; }
.k-content a { color: var(--k-accent); text-decoration: underline; }
.k-content hr { border: none; border-top: 0.5px solid var(--k-border); margin: 2rem 0; }
.k-content table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 1rem; }
.k-content td, .k-content th { padding: .6rem .75rem; border: 0.5px solid var(--k-border); }
.k-content th { background: var(--k-surface); font-weight: 500; color: var(--k-fg); }

/* ── START PAGE CARDS ────────────────────────────────────── */
.k-cards { display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; background: var(--k-border); border: 0.5px solid var(--k-border); margin-bottom: 3rem; }
.k-card { background: var(--k-bg); padding: 1.5rem; display: block; transition: background .15s; }
.k-card:hover { background: var(--k-surface); opacity: 1; }
.k-card-icon { font-size: 20px; margin-bottom: .75rem; }
.k-card-title { font-size: 14px; font-weight: 500; margin-bottom: .35rem; color: var(--k-fg); }
.k-card-desc { font-size: 13px; color: var(--k-muted); line-height: 1.6; }
@media (max-width: 600px) { .k-cards { grid-template-columns: 1fr 1fr; } }
@media (max-width: 400px) { .k-cards { grid-template-columns: 1fr; } }

/* ── GALLERY ─────────────────────────────────────────────── */
.k-gallery { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.k-gallery-item { aspect-ratio: 1; overflow: hidden; border-radius: 3px; border: 0.5px solid var(--k-border); position: relative; background: var(--k-surface); }
.k-gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.k-gallery-item:hover img { transform: scale(1.04); }
.k-gallery-caption { position: absolute; bottom: 0; left: 0; right: 0; padding: .5rem .75rem; font-size: 11px; color: #fff; background: linear-gradient(transparent,rgba(0,0,0,.5)); }
@media (max-width: 600px) { .k-gallery { grid-template-columns: repeat(2,1fr); } }

/* ── CALENDAR ────────────────────────────────────────────── */
.k-calendar-wrap { border: 0.5px solid var(--k-border); border-radius: var(--k-radius); overflow: hidden; margin-bottom: 2rem; }
.k-cal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.5rem; border-bottom: 0.5px solid var(--k-border); background: var(--k-surface); }
.k-cal-header h3 { font-size: 15px; font-weight: 500; }
.k-cal-nav { background: none; border: 0.5px solid var(--k-border); width: 32px; height: 32px; border-radius: var(--k-radius); cursor: pointer; font-size: 16px; color: var(--k-muted); display: flex; align-items: center; justify-content: center; }
.k-cal-nav:hover { background: var(--k-bg); }
.k-cal-grid { display: grid; grid-template-columns: repeat(7,1fr); background: var(--k-surface); }
.k-cal-dow { text-align: center; padding: .6rem; font-size: 11px; letter-spacing: .06em; color: var(--k-muted); text-transform: uppercase; border-bottom: 0.5px solid var(--k-border); }
.k-cal-day { text-align: center; padding: .5rem .25rem; font-size: 13px; border-bottom: 0.5px solid var(--k-border); border-right: 0.5px solid var(--k-border); min-height: 52px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 2px; }
.k-cal-day:nth-child(7n) { border-right: none; }
.k-cal-day.empty { background: var(--k-bg); }
.k-cal-day.booked { background: rgba(139,69,19,.08); }
.k-cal-day.booked .k-cal-num { color: var(--k-accent); font-weight: 600; }
.k-cal-day.booked .k-cal-who { font-size: 9px; color: var(--k-accent); opacity: .8; max-width: 95%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k-cal-day.today .k-cal-num { font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.k-cal-legend { display: flex; gap: 1.5rem; padding: .75rem 1.5rem; border-top: 0.5px solid var(--k-border); background: var(--k-surface); }
.k-cal-legend-item { display: flex; align-items: center; gap: .4rem; font-size: 12px; color: var(--k-muted); }
.k-cal-dot { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.k-cal-dot.booked { background: rgba(139,69,19,.25); }
.k-cal-dot.free { background: var(--k-bg); border: 0.5px solid var(--k-border); }

/* ── CONTACT FORM ────────────────────────────────────────── */
.k-contact-form { display: flex; flex-direction: column; gap: 12px; max-width: 480px; }
.k-contact-form input, .k-contact-form textarea {
  border: 0.5px solid var(--k-border); background: var(--k-surface);
  color: var(--k-fg); padding: 10px 14px; font-size: 14px;
  border-radius: var(--k-radius); font-family: var(--k-font); outline: none;
  transition: border-color .15s; width: 100%;
}
.k-contact-form input { height: 42px; }
.k-contact-form textarea { height: 120px; resize: none; }
.k-contact-form input:focus, .k-contact-form textarea:focus { border-color: var(--k-accent); }
.k-form-submit { align-self: flex-start; padding: 10px 24px; background: var(--k-accent); color: #fff; border: none; cursor: pointer; font-size: 13px; letter-spacing: .06em; border-radius: var(--k-radius); font-family: var(--k-font); transition: background .15s; }
.k-form-submit:hover { background: var(--k-accent-h); }
.k-form-success { font-size: 13px; color: var(--k-accent); display: none; margin-top: .5rem; }

/* ── MAP ─────────────────────────────────────────────────── */
.k-map { border-radius: var(--k-radius); overflow: hidden; border: 0.5px solid var(--k-border); aspect-ratio: 16/9; margin: 1.5rem 0; }
.k-map iframe { width: 100%; height: 100%; border: none; display: block; }

/* ── EDIT HINT (admin only) ──────────────────────────────── */
.k-edit-hint { font-size: 12px; color: var(--k-muted); margin-top: 1.5rem; padding-top: 1rem; border-top: 0.5px solid var(--k-border); }
.k-edit-hint a { color: var(--k-accent); }

/* ── FOOTER ──────────────────────────────────────────────── */
.k-footer { border-top: 0.5px solid var(--k-border); padding: 1.5rem 2rem; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.k-footer span, .k-footer a { font-size: 12px; color: var(--k-muted); }
.k-footer a:hover { opacity: .75; }


body.admin-bar { padding-top: calc(var(--k-nav-h) + 32px); }
@media screen and (max-width: 782px) {
  body.admin-bar .k-nav { top: 46px; }
  body.admin-bar { padding-top: calc(var(--k-nav-h) + 46px); }
}
