/*
Theme Name: MGIN
Theme URI: https://example.com/mgin
Author: MG
Author URI: https://example.com
Description: A slick black & white photography portfolio theme. Photo keywords automatically build the album menu — tag a photo with "minimalism" + "nature" and it appears in both albums. Editorial serif typography, masonry gallery, lightbox viewer.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: mgin
Tags: photography, portfolio, dark, minimal, custom-menu, custom-post-type, threaded-comments, translation-ready
*/

/* ─── Reset & root ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #080808;
  --sidebar-bg: #0b0b0b;
  --surface: #111111;
  --border: #1e1e1e;
  --border-light: #282828;
  --text: #f5f1ea;
  --muted: #9a9590;
  --muted2: #6b6660;
  --accent: #b89460;
  --sidebar-w: 260px;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'DM Sans', system-ui, sans-serif;
}

html, body { background: var(--bg); color: var(--text); min-height: 100%; }
body { font-family: var(--font-sans); font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }
* { scrollbar-width: thin; scrollbar-color: var(--border-light) transparent; }

/* ─── Layout ─────────────────────────────────────────────────────────────── */
.mg-app { display: flex; min-height: 100vh; }
.mg-main { flex: 1; min-width: 0; }

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.mg-sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w); flex-shrink: 0;
  background: var(--sidebar-bg); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 0 28px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.mg-sidebar__brand { padding: 36px 0 32px; border-bottom: 1px solid var(--border); }
.mg-sidebar__brand a { display: block; }
.mg-sidebar__brand h1 {
  font-family: var(--font-serif); font-weight: 500; font-size: 28px;
  letter-spacing: 0.08em; line-height: 1;
}
.mg-sidebar__brand p {
  font-size: 10px; color: var(--muted); letter-spacing: 0.18em;
  text-transform: uppercase; margin-top: 6px;
}
.mg-sidebar nav { padding: 24px 0 20px; border-bottom: 1px solid var(--border); }
.mg-nav-item {
  display: block; padding: 8px 0; font-size: 12px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); position: relative; transition: color 0.2s;
}
.mg-nav-item:hover { color: rgba(237,232,224,0.65); }
.mg-nav-item.active { color: var(--text); }
.mg-nav-item.active::before {
  content: ''; position: absolute; left: -16px; top: 50%;
  transform: translateY(-50%); width: 3px; height: 14px; background: var(--accent);
}

.mg-albums { padding: 20px 0; flex: 1; }
.mg-albums__toggle {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: none; border: none; cursor: pointer; padding: 4px 0 12px;
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted2);
}
.mg-albums__toggle .caret { transition: transform 0.3s; font-size: 9px; }
.mg-albums.is-collapsed .mg-albums__list { max-height: 0; }
.mg-albums.is-collapsed .mg-albums__toggle .caret { transform: rotate(-90deg); }
.mg-albums__list {
  overflow: hidden; max-height: 800px;
  transition: max-height 0.4s cubic-bezier(0.4,0,0.2,1);
}
.mg-album {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 8px 7px 10px; font-size: 12px; color: var(--muted);
  border-left: 2px solid transparent; transition: all 0.2s; margin-bottom: 1px;
  text-transform: capitalize;
}
.mg-album:hover { color: rgba(237,232,224,0.65); border-left-color: var(--border-light); }
.mg-album.active { color: var(--text); border-left-color: var(--accent); background: rgba(184,148,96,0.06); }
.mg-album__count { font-size: 10px; color: var(--muted2); font-variant-numeric: tabular-nums; }

.mg-sidebar__foot { padding: 16px 0 24px; border-top: 1px solid var(--border); }
.mg-sidebar__foot p { font-size: 10px; color: var(--muted2); line-height: 1.6; }

/* ─── Page header ────────────────────────────────────────────────────────── */
.mg-page-head { padding: 32px 32px 0; }
.mg-page-head__eyebrow {
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;
}
.mg-page-head h2 {
  font-family: var(--font-serif); font-weight: 400; font-size: 24px;
  line-height: 1; color: var(--text);
}
.mg-page-head h2 em { font-style: italic; }
.mg-page-head__count { font-size: 11px; color: var(--muted); margin-top: 6px; }
.mg-page-head__row { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.mg-clear-filter {
  background: none; border: 1px solid var(--border-light); cursor: pointer;
  padding: 6px 14px; font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted); transition: all 0.2s;
}
.mg-clear-filter:hover { color: var(--text); border-color: var(--muted2); }

/* ─── Keyword pills ──────────────────────────────────────────────────────── */
.mg-pills { display: flex; gap: 6px; flex-wrap: wrap; padding: 28px 32px 24px; }
.mg-pill {
  background: none; border: 1px solid var(--border-light); cursor: pointer;
  padding: 5px 12px; font-size: 11px; color: var(--muted);
  transition: all 0.2s; letter-spacing: 0.05em; text-transform: capitalize;
}
.mg-pill:hover { color: var(--text); border-color: var(--muted2); }
.mg-pill.active { background: var(--accent); border-color: var(--accent); color: #080808; }
.mg-pill__count { opacity: 0.5; margin-left: 4px; font-size: 10px; }

.mg-divider { height: 1px; background: var(--border); margin: 0 32px 24px; }

/* ─── Masonry ────────────────────────────────────────────────────────────── */
.mg-masonry {
  column-count: 3; column-gap: 12px; padding: 0 32px 48px;
}
@media (max-width: 1200px) { .mg-masonry { column-count: 2; } }
@media (max-width: 720px) { .mg-masonry { column-count: 1; } }
.mg-card {
  break-inside: avoid; margin-bottom: 12px; position: relative; overflow: hidden;
  cursor: pointer; display: block; transition: transform 0.3s ease;
}
.mg-card:hover { transform: translateY(-2px); }
.mg-card img { transition: transform 0.4s ease; }
.mg-card:hover img { transform: scale(1.015); }
.mg-card__overlay {
  position: absolute; inset: 0; padding: 14px;
  display: flex; flex-direction: column; justify-content: flex-end;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 50%);
  opacity: 0; transition: opacity 0.35s ease;
}
.mg-card:hover .mg-card__overlay { opacity: 1; }
.mg-card__title { font-family: var(--font-serif); font-style: italic; font-size: 13px; color: var(--text); }
.mg-card__date { font-size: 10px; color: rgba(237,232,224,0.55); margin-top: 2px; letter-spacing: 0.05em; }

.mg-empty {
  text-align: center; padding: 80px 32px; color: var(--muted);
  font-family: var(--font-serif); font-style: italic; font-size: 18px;
}

/* ─── Home ───────────────────────────────────────────────────────────────── */
.mg-hero { position: relative; height: calc(100vh - 160px); overflow: hidden; cursor: pointer; }
.mg-hero img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(0.6) brightness(0.55); }
.mg-hero__content {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 40px;
}
.mg-hero__eyebrow {
  font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase;
  color: rgba(237,232,224,0.5); margin-bottom: 20px;
}
.mg-hero h2 {
  font-family: var(--font-serif); font-weight: 400; font-style: italic;
  font-size: clamp(40px, 6vw, 72px); color: var(--text); line-height: 1.1;
}
.mg-hero__rule { width: 40px; height: 1px; background: var(--accent); margin: 24px auto; opacity: 0.8; }
.mg-hero__cta {
  font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
  color: rgba(237,232,224,0.45);
}

.mg-recent {
  padding: 24px 32px; border-top: 1px solid var(--border);
  background: var(--sidebar-bg);
}
.mg-recent__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.mg-recent__label { font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.mg-recent__viewall { font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted); }
.mg-recent__viewall:hover { color: var(--text); }
.mg-recent__strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.mg-recent__strip img {
  height: 80px; width: 80px; object-fit: cover; flex-shrink: 0;
  opacity: 0.75; transition: opacity 0.2s; cursor: pointer;
}
.mg-recent__strip img:hover { opacity: 1; }

/* ─── Pages (about / contact / page.php) ──────────────────────────────────── */
.mg-page-body { padding: 48px 48px 80px; max-width: 680px; }
.mg-page-body__eyebrow {
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 32px;
}
.mg-page-body h2.mg-page-title {
  font-family: var(--font-serif); font-weight: 400; font-size: 36px;
  line-height: 1.15; margin-bottom: 28px;
}
.mg-page-body h2.mg-page-title em { font-style: italic; }
.mg-page-body .mg-rule { width: 32px; height: 1px; background: var(--accent); margin-bottom: 32px; }
.mg-page-body p, .mg-page-body li {
  font-family: var(--font-serif); font-size: 16px; color: rgba(237,232,224,0.75);
  line-height: 1.8; margin-bottom: 20px;
}
.mg-page-body a { color: var(--text); border-bottom: 1px solid var(--border-light); }
.mg-page-body a:hover { border-bottom-color: var(--muted); }

/* ─── Lightbox ───────────────────────────────────────────────────────────── */
.mg-lightbox {
  position: fixed; inset: 0; background: rgba(4,4,4,0.96); z-index: 1000;
  display: none; align-items: center; justify-content: center;
}
.mg-lightbox.is-open { display: flex; animation: mgFade 0.25s ease; }
@keyframes mgFade { from { opacity: 0; } to { opacity: 1; } }
.mg-lightbox__inner { position: relative; max-width: calc(100vw - 160px); max-height: 90vh; display: flex; flex-direction: column; gap: 16px; }
.mg-lightbox__img { max-width: 100%; max-height: 80vh; object-fit: contain; }
.mg-lightbox__meta { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
.mg-lightbox__title { font-family: var(--font-serif); font-size: 16px; letter-spacing: 0.02em; }
.mg-lightbox__date { font-size: 11px; color: var(--muted); margin-top: 4px; }
.mg-lightbox__tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 320px; }
.mg-lightbox__tag {
  font-size: 10px; padding: 3px 8px; border: 1px solid var(--border-light);
  color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase;
}
.mg-lightbox__nav {
  position: fixed; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--muted);
  font-size: 28px; line-height: 1; padding: 12px 8px; transition: color 0.2s;
}
.mg-lightbox__nav:hover { color: var(--text); }
.mg-lightbox__prev { left: 24px; }
.mg-lightbox__next { right: 24px; }
.mg-lightbox__close {
  position: fixed; top: 24px; right: 24px; background: none; border: none;
  cursor: pointer; color: var(--muted); font-size: 20px; padding: 8px;
  transition: color 0.2s;
}
.mg-lightbox__close:hover { color: var(--text); }
.mg-lightbox__counter {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  font-size: 11px; color: var(--muted); letter-spacing: 0.1em;
}

/* ─── Form (contact) ─────────────────────────────────────────────────────── */
.mg-form { display: flex; flex-direction: column; gap: 28px; margin-top: 8px; }
.mg-form label {
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); display: block; margin-bottom: 8px;
}
.mg-form input, .mg-form textarea {
  background: none; border: none; border-bottom: 1px solid var(--border-light);
  padding: 10px 0; width: 100%; font-family: var(--font-sans); font-size: 14px;
  color: var(--text); outline: none; transition: border-color 0.2s;
}
.mg-form textarea {
  border: 1px solid var(--border-light); padding: 12px; resize: none; line-height: 1.6;
}
.mg-form input:focus, .mg-form textarea:focus { border-bottom-color: var(--muted); border-color: var(--muted); }
.mg-btn {
  align-self: flex-start; background: var(--accent); border: none; cursor: pointer;
  padding: 11px 28px; font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase; color: #080808; font-weight: 500; transition: opacity 0.2s;
}
.mg-btn:hover { opacity: 0.85; }

/* ─── Mobile ─────────────────────────────────────────────────────────────── */
.mg-mobile-toggle {
  display: none; position: fixed; top: 16px; left: 16px; z-index: 500;
  background: var(--surface); border: 1px solid var(--border-light);
  padding: 10px 14px; cursor: pointer; color: var(--text);
  font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase;
}
@media (max-width: 860px) {
  .mg-app { flex-direction: column; }
  .mg-sidebar {
    position: fixed; top: 0; left: 0; z-index: 400;
    transform: translateX(-100%); transition: transform 0.3s;
  }
  .mg-sidebar.is-open { transform: translateX(0); }
  .mg-mobile-toggle { display: block; }
  .mg-main { padding-top: 56px; }
  .mg-lightbox__inner { max-width: calc(100vw - 48px); }
  .mg-lightbox__prev { left: 4px; }
  .mg-lightbox__next { right: 4px; }
}
