/*
Theme Name:  Minimalight
Theme URI:   https://example.com/minimalight
Author:      Minimalight
Author URI:  https://example.com
Description: A minimal photography portfolio theme with a fixed left sidebar, an interactive word-trail front page, a polaroid gallery, and a fine-art print shop powered by WooCommerce. Includes a full theme options page, Customizer support and dark mode. Requires the Minimalight Core companion plugin for the portfolio and print shop features.
Version:     1.0.0
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
License:     GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags:        photography, portfolio, e-commerce, one-column, custom-colors, custom-menu, custom-logo, featured-images, translation-ready
Text Domain: minimalight
*/

/* ─── CSS Custom Properties ───────────────────────────────────────────────
   Light values live in :root; dark values under body.ml-dark (and the
   prefers-color-scheme media query for body.ml-auto). Customizer / theme
   option colors are layered on top by inc/dark-mode.php.                  */
:root {
  --bg:             #d2d2d2;
  --sidebar-bg:     #f8f8f6;
  --sidebar-border: #e0e0de;
  --text:           #111111;
  --text-muted:     #888888;
  --text-faint:     #aaaaaa;
  --content-text:   #333333;
  --card-bg:        #f8f8f6;
  --hero-bg:        #f0efeb;
  --hero-ink:       #2c2c2a;
  --surface:        #f0efeb;   /* split-layout page background */
  --surface-border: #d8d7d3;
}

body.ml-dark {
  --bg:             #161616;
  --sidebar-bg:     #1e1e1c;
  --sidebar-border: #2c2c2a;
  --text:           #eaeaea;
  --text-muted:     #9a9a9a;
  --text-faint:     #6f6f6f;
  --content-text:   #c9c9c6;
  --card-bg:        #1e1e1c;
  --hero-bg:        #161616;
  --hero-ink:       #d8d8d4;
  --surface:        #191918;
  --surface-border: #2c2c2a;
}

@media (prefers-color-scheme: dark) {
  body.ml-auto {
    --bg:             #161616;
    --sidebar-bg:     #1e1e1c;
    --sidebar-border: #2c2c2a;
    --text:           #eaeaea;
    --text-muted:     #9a9a9a;
    --text-faint:     #6f6f6f;
    --content-text:   #c9c9c6;
    --card-bg:        #1e1e1c;
    --hero-bg:        #161616;
    --hero-ink:       #d8d8d4;
    --surface:        #191918;
    --surface-border: #2c2c2a;
  }
}

/* ─── Reset & Base ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
main { display: block; margin: 0; padding: 0; }

html {
  scrollbar-gutter: stable; /* Reserve scrollbar space always — prevents layout reflow when scrollbar appears/disappears between pages */
}

html, body {
  height: 100%;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 10px;
  color: var(--text);
  background: var(--bg);
}

body { transition: background 0.3s, color 0.3s; }

a { color: inherit; text-decoration: none; }
a:hover { opacity: 0.6; }
img { display: block; max-width: 100%; height: auto; }
ul { list-style: none; }

/* Accessibility: screen-reader text (used by skip links / labels) */
.screen-reader-text {
  border: 0;
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute !important;
  width: 1px;
  word-wrap: normal !important;
}

/* ─── Layout ─────────────────────────────────────────────────────────── */
#page {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────────────────── */
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 0 32px 28px;
  z-index: 150;
  overflow-y: auto;
  transition: background 0.3s, border-color 0.3s;
}

/* Branding */
.site-branding {
  flex-shrink: 0;
  padding-top: 140px; /* Base breathing room from top edge */
}

.site-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.35;
  color: var(--text);
  margin-bottom: 8px;
}
.site-title a { color: inherit; }

.custom-logo-link { display: inline-block; margin-bottom: 12px; }

.site-description {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.6;
}

.sidebar-nav-spacer {
  flex-grow: 1;
  flex-shrink: 0;
  flex-basis: 60px;
  max-height: 160px;
}
.sidebar-bottom-spacer {
  flex-grow: 1;
  flex-shrink: 0;
  flex-basis: 40px;
  max-height: none;
}

/* Navigation */
.main-navigation { flex-shrink: 0; }

.main-navigation ul {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.main-navigation ul li a {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  display: block;
  padding: 2px 0;
  transition: opacity 0.2s;
}
.main-navigation ul li.current-menu-item a,
.main-navigation ul li a:hover { opacity: 0.4; }

/* Social links */
.sidebar-social {
  flex-shrink: 0;
  margin-bottom: 28px;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.sidebar-social a { color: var(--text-muted); transition: opacity 0.2s; }
.sidebar-social a:hover { opacity: 0.5; }

/* Sidebar widget area (bottom of sidebar) */
.sidebar-widgets {
  flex-shrink: 0;
  border-top: 1px solid var(--sidebar-border);
  padding-top: 20px;
  margin-bottom: 20px;
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.6;
}
.sidebar-widgets .widget { margin-bottom: 14px; }
.sidebar-widgets .widget-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 7px;
}

/* Footer / copyright */
.sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--sidebar-border);
  padding-top: 16px;
  font-size: 9px;
  color: var(--text-faint);
  line-height: 1.7;
  letter-spacing: 0.02em;
}
.sidebar-footer a { color: var(--text-faint); }

/* Dark mode toggle (sun / moon button) */
.ml-mode-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-faint);
  padding: 0;
  margin-bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 0.2s;
}
.ml-mode-toggle:hover { color: var(--text); }
.ml-mode-toggle svg { width: 14px; height: 14px; display: block; }
.ml-mode-toggle .ml-icon-sun  { display: none; }
.ml-mode-toggle .ml-icon-moon { display: block; }
body.ml-dark .ml-mode-toggle .ml-icon-sun  { display: block; }
body.ml-dark .ml-mode-toggle .ml-icon-moon { display: none; }

/* ─── Main Content ───────────────────────────────────────────────────── */
#content {
  margin-left: 240px;
  flex: 1;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  transition: background 0.3s;
}

#content .site-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  min-height: 0;
}

/* ─── Portfolio / Archive Grid ───────────────────────────────────────── */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2px;
  padding: 2px;
}

.portfolio-item {
  position: relative;
  overflow: hidden;
  background: #111;
  aspect-ratio: 4/3;
  cursor: pointer;
}
.portfolio-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.4s ease, transform 0.6s ease;
}
.portfolio-item:hover img { opacity: 0.7; transform: scale(1.03); }

.portfolio-item-info {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 16px;
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
  opacity: 0;
  transition: opacity 0.3s ease;
}
.portfolio-item:hover .portfolio-item-info { opacity: 1; }
.portfolio-item-title {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  font-weight: 400;
}

/* ─── Single Post / Page ─────────────────────────────────────────────── */
.entry-wrapper {
  max-width: 680px;
  margin: 60px 60px;
  padding-bottom: 80px;
}
.entry-header { margin-bottom: 32px; }
.entry-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 8px;
}
.entry-meta {
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.entry-content {
  font-size: 12px;
  line-height: 1.75;
  color: var(--content-text);
}
.entry-content p { margin-bottom: 1.4em; }
.entry-content h2 { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 0.8em; margin-top: 2em; font-weight: 700; }
.entry-content h3 { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 0.6em; margin-top: 1.6em; font-weight: 700; }
.entry-content img { margin: 2em 0; }
.entry-content a { border-bottom: 1px solid var(--text-faint); padding-bottom: 1px; }
.entry-content a:hover { border-color: var(--text); opacity: 1; }
.entry-content blockquote {
  border-left: 2px solid var(--text);
  padding-left: 20px;
  margin: 1.6em 0;
  font-style: italic;
  color: var(--text-muted);
}

.post-navigation {
  margin-top: 40px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.post-navigation .nav-links { display: flex; justify-content: space-between; gap: 20px; }

/* ─── About Page ─────────────────────────────────────────────────────── */
.about-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  min-height: 100vh;
}
.about-image {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
.about-image img { width: 100%; height: 100%; object-fit: cover; }
.about-text { padding: 60px 50px; }

/* ─── 404 ────────────────────────────────────────────────────────────── */
.not-found-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  flex-direction: column;
  gap: 16px;
}
.not-found-wrapper .code {
  font-size: 80px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-faint);
}
.not-found-wrapper .message {
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ─── Pagination ─────────────────────────────────────────────────────── */
.pagination {
  padding: 40px 60px;
  display: flex;
  gap: 8px;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.pagination a, .pagination span {
  padding: 4px 8px;
  border: 1px solid var(--text-faint);
  color: var(--text-muted);
  transition: all 0.2s;
}
.pagination a:hover { background: var(--text); color: var(--bg); border-color: var(--text); opacity: 1; }
.pagination .current { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ─── Admin hint (shown to logged-in admins when Core plugin missing) ── */
.ml-plugin-hint {
  margin-top: 12px;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.ml-plugin-hint a { border-bottom: 1px solid var(--text-faint); }

/* ════════════════════════════════════════════════════════════
   MOBILE  (≤ 1024px)
   Sidebar is fully hidden. A fixed top bar + hamburger button
   opens a fullscreen overlay menu.
   ════════════════════════════════════════════════════════════ */

.mob-topbar, .mob-hamburger, .mob-menu { display: none; }

@media (max-width: 1024px) {

  /* Hide desktop sidebar completely */
  #sidebar { display: none; }

  /* Remove sidebar margin, push below top bar */
  #content {
    margin-left: 0;
    padding-top: 64px;
  }

  /* Fixed top bar */
  .mob-topbar {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 64px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--sidebar-border);
    z-index: 500;
    transition: background 0.3s, border-color 0.3s;
  }
  .mob-topbar-title a {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text);
    text-decoration: none;
  }

  /* Hamburger */
  .mob-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    position: fixed;
    top: 12px; left: 16px;
    width: 40px; height: 40px;
    background: transparent;
    border: none;
    z-index: 600;
    cursor: pointer;
    padding: 0;
  }
  .mob-hamburger span {
    display: block;
    width: 24px; height: 2px;
    background: var(--text);
    transition: 0.3s;
  }
  .mob-hamburger.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .mob-hamburger.is-active span:nth-child(2) { opacity: 0; }
  .mob-hamburger.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* Fullscreen overlay menu */
  .mob-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 18vh;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg);
    z-index: 550;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .mob-menu.is-open { opacity: 1; pointer-events: auto; }

  .mob-menu-nav { list-style: none; padding: 0; text-align: center; margin-bottom: 40px; }
  .mob-menu-nav li { margin: 20px 0; }
  .mob-menu-nav li a {
    font-size: 24px;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-decoration: none;
    transition: opacity 0.2s;
  }
  .mob-menu-nav li a:hover { opacity: 0.5; }

  .mob-menu-social { margin-bottom: 35px; }
  .mob-menu-social a { color: var(--text); opacity: 0.5; }
  .mob-menu-social a:hover { opacity: 1; }

  .mob-menu-toggle-row { margin-bottom: 30px; }

  .mob-menu-footer {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 40px;
  }

  /* Staggered link entrance animation */
  .mob-menu.is-open .mob-menu-nav li {
    animation: mobLinkIn 0.45s ease both;
  }
  .mob-menu.is-open .mob-menu-nav li:nth-child(1) { animation-delay: 0.05s; }
  .mob-menu.is-open .mob-menu-nav li:nth-child(2) { animation-delay: 0.10s; }
  .mob-menu.is-open .mob-menu-nav li:nth-child(3) { animation-delay: 0.15s; }
  .mob-menu.is-open .mob-menu-nav li:nth-child(4) { animation-delay: 0.20s; }
  .mob-menu.is-open .mob-menu-nav li:nth-child(5) { animation-delay: 0.25s; }
  .mob-menu.is-open .mob-menu-nav li:nth-child(6) { animation-delay: 0.30s; }

  /* Layout adjustments */
  .about-layout  { grid-template-columns: 1fr; }
  .about-image   { position: relative; height: 56vw; }
  .entry-wrapper { margin: 32px 20px; padding-bottom: 48px; }
  .pagination    { padding: 30px 20px; }

  .portfolio-grid { grid-template-columns: 1fr 1fr; gap: 2px; }
}

@keyframes mobLinkIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
  .portfolio-grid { grid-template-columns: 1fr; gap: 1px; padding: 1px; }
  .entry-wrapper  { margin: 24px 16px; }
  .mob-menu-nav li a { font-size: 22px; }
}
