/*
Theme Name: Terra Frame
Theme URI: https://example.com
Author: Your Studio
Description: A minimal, editorial WordPress theme for photography and creative portfolios. Contact-sheet inspired layout with a warm terracotta, cream, and olive palette.
Version: 1.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: terra-frame
*/

/* ============================================
   TOKENS
   ============================================ */
:root {
  --cream: #F2EBDD;
  --cream-light: #FBF7EF;
  --terracotta: #B85C38;
  --terracotta-dark: #8F4326;
  --olive: #6E6B47;
  --olive-dark: #4F4C34;
  --ink: #2B2420;
  --ink-soft: #5C4F45;
  --line: rgba(43, 36, 32, 0.07);

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Space Mono', 'Courier New', monospace;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.75rem;
  --space-4: 3rem;
  --space-5: 5rem;
  --space-6: 8rem;

  --max-width: 1240px;
}

/* ============================================
   RESET
   ============================================ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; height: auto; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0 0 var(--space-2); color: var(--ink); }
p { margin: 0 0 var(--space-2); }
button { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

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

/* Wider wrap for image grids — more room per photo than the reading-width container */
.grid-wrap {
  max-width: 1800px;
  margin: 0 auto;
  padding: 0 var(--space-2);
}

/* Break an element out to full viewport width from inside a centered container */
.full-bleed {
  position: relative;
  left: 50%;
  right: 50%;
  width: 100vw;
  margin-left: -50vw;
  margin-right: -50vw;
  overflow: hidden;
}
.full-bleed img,
.full-bleed video,
.full-bleed iframe {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* Native WordPress wide/full block alignment, so images and galleries
   dropped into post/page content can be made immersive from the editor. */
.entry-content .alignwide,
.project-content .alignwide,
.page-content .alignwide {
  max-width: calc(var(--max-width) + 240px);
  width: calc(100% + 240px);
  margin-left: calc(-120px);
  margin-right: calc(-120px);
}
.entry-content .alignfull,
.project-content .alignfull,
.page-content .alignfull {
  width: 100vw;
  max-width: 100vw;
  margin-left: 50%;
  transform: translateX(-50%);
}
.entry-content .alignfull img,
.project-content .alignfull img,
.page-content .alignfull img { width: 100%; }

@media (max-width: 1000px) {
  .entry-content .alignwide,
  .project-content .alignwide,
  .page-content .alignwide { width: 100%; margin-left: 0; margin-right: 0; }
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--terracotta-dark);
  display: inline-block;
  margin-bottom: var(--space-2);
}

.hairline { border: none; border-top: 1px solid var(--line); margin: var(--space-4) 0; }

/* ============================================
   SPROCKET MOTIF (signature element)
   A thin strip of "contact sheet" perforations,
   used above/below key sections.
   ============================================ */
.sprockets {
  height: 14px;
  background-image: radial-gradient(circle, var(--ink) 2.5px, transparent 2.6px);
  background-size: 26px 14px;
  background-position: center;
  background-repeat: repeat-x;
  opacity: 0.18;
}

/* ============================================
   HEADER / NAV
   ============================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--cream);
  border-bottom: 1px solid var(--line);
}
.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  max-width: var(--max-width);
  margin: 0 auto;
}
.site-branding { display: flex; align-items: center; }
.brand-link { display: flex; align-items: center; gap: 0.65rem; }
.brand-mark { height: 32px; width: auto; }
.brand-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.primary-menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--ink);
  border-radius: 2px;
  padding: 0.4rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.primary-menu {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.primary-menu > li { position: relative; }
.primary-menu > li > a {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.1rem;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.primary-menu > li > a:hover,
.primary-menu > li.current-menu-item > a {
  color: var(--terracotta-dark);
  border-bottom-color: var(--terracotta);
}

/* Dropdown: portfolio categories, shown on hover (desktop) */
.menu-item-has-children { display: flex; align-items: center; }
.sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  margin-top: 0.6rem;
  padding: 0.5rem 0;
  background: var(--cream-light);
  border: 1px solid var(--line);
  box-shadow: 0 12px 28px rgba(43, 36, 32, 0.08);
  z-index: 60;
}
.sub-menu li a {
  display: block;
  padding: 0.55rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.sub-menu li a:hover { color: var(--terracotta-dark); background: var(--cream); }
@media (min-width: 721px) {
  .menu-item-has-children:hover .sub-menu { display: block; }
}
.submenu-toggle {
  display: none;
  background: none;
  border: none;
  padding: 0 0 0 0.3rem;
  cursor: pointer;
  color: inherit;
  font-size: 0.7rem;
}

@media (max-width: 720px) {
  .primary-menu-toggle { display: inline-block; }

  .submenu-toggle { display: inline-block; }

  .primary-menu {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
    position: fixed;
    inset: 0;
    top: 65px;
    background: var(--cream);
    padding: var(--space-4) var(--space-4);
    overflow-y: auto;
  }
  .primary-menu.is-open { display: flex; }
  .primary-menu > li { width: 100%; }
  .primary-menu > li > a { font-size: 1.4rem; padding: 0.4rem 0; }

  .menu-item-has-children { flex-wrap: wrap; }
  .sub-menu {
    display: none;
    position: static;
    width: 100%;
    border: none;
    box-shadow: none;
    background: none;
    padding: 0.3rem 0 0.3rem 1rem;
    margin-top: 0;
  }
  .menu-item-has-children:hover .sub-menu { display: none; }
  .menu-item-has-children.is-open .sub-menu { display: block; }
  .sub-menu li a { font-size: 1rem; padding: 0.5rem 0; }
}

/* ============================================
   HERO
   ============================================ */
.hero {
  padding: var(--space-6) 0 var(--space-5);
  text-align: center;
  position: relative;
}
.hero .eyebrow { margin-bottom: var(--space-3); }
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  max-width: 16ch;
  margin: 0 auto var(--space-3);
}
.hero p.hero-sub {
  max-width: 46ch;
  margin: 0 auto;
  color: var(--ink-soft);
  font-size: 1.1rem;
}
.hero-cta {
  margin-top: var(--space-4);
  display: inline-flex;
  gap: var(--space-3);
}

/* Immersive cover-photo hero, active when a background image is set in the Customizer */
.hero.has-bg {
  min-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
  padding: var(--space-5) 0;
}
.hero.has-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(43, 36, 32, 0.18), rgba(43, 36, 32, 0.6));
}
.hero.has-bg .container { position: relative; z-index: 1; }
.hero.has-bg h1,
.hero.has-bg p.hero-sub,
.hero.has-bg .eyebrow { color: var(--cream-light); }
.hero.has-bg .btn { border-color: var(--cream-light); color: var(--cream-light); }
.hero.has-bg .btn:hover { background: var(--cream-light); color: var(--ink); }
.hero.has-bg .btn-solid { background: var(--terracotta); border-color: var(--terracotta); }
.hero.has-bg .btn-solid:hover { background: var(--terracotta-dark); border-color: var(--terracotta-dark); color: var(--cream-light); }

@media (max-width: 720px) {
  .hero.has-bg { min-height: 78vh; }
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.85rem 1.6rem;
  border: 1px solid var(--ink);
  border-radius: 2px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: var(--ink); color: var(--cream-light); }
.btn-solid {
  background: var(--terracotta);
  border-color: var(--terracotta);
  color: var(--cream-light);
}
.btn-solid:hover { background: var(--terracotta-dark); border-color: var(--terracotta-dark); }

/* ============================================
   PORTFOLIO GRID (contact-sheet frames)
   ============================================ */
.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
  gap: var(--space-2);
}
.section-heading h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); margin: 0; }

.frame-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}
@media (max-width: 1100px) { .frame-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) {
  .frame-grid { grid-template-columns: 1fr; gap: 2px; margin: 0 calc(-1 * var(--space-2)); }
  .frame-caption { padding: var(--space-2) var(--space-2); }
}

.frame {
  position: relative;
  background: var(--cream-light);
}
.frame-media {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--olive);
}
.frame-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}
.frame:hover .frame-media img { transform: scale(1.04); }
.frame-number {
  position: absolute;
  top: var(--space-1);
  left: var(--space-1);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--cream-light);
  background: rgba(43, 36, 32, 0.55);
  padding: 0.15rem 0.5rem;
  z-index: 2;
}
.frame-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(43, 36, 32, 0.55);
  color: var(--cream-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  z-index: 2;
}
.frame-caption {
  padding: var(--space-2);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
}
.frame-caption h3 { font-size: 1.05rem; margin: 0; }
.frame-caption .frame-cat {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--olive-dark);
  white-space: nowrap;
}

/* Portfolio filter tabs */
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-4);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.filter-tabs a { padding-bottom: 0.25rem; border-bottom: 2px solid transparent; color: var(--ink-soft); }
.filter-tabs a.is-active,
.filter-tabs a:hover { color: var(--terracotta-dark); border-bottom-color: var(--terracotta); }

/* ============================================
   SINGLE PORTFOLIO PROJECT
   ============================================ */
.project-header { padding: var(--space-5) 0 var(--space-3); text-align: center; }
.project-header h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
.project-meta {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: var(--space-2);
}
.project-video { position: relative; aspect-ratio: 16 / 9; background: var(--ink); }
.project-video iframe,
.project-video video { position: absolute; inset: 0; width: 100%; height: 100%; }

.project-content { max-width: 820px; margin: 0 auto; padding-bottom: var(--space-5); }
.project-content .wp-block-gallery,
.project-content figure { margin: var(--space-4) 0; }
.project-content img { width: 100%; }

.project-nav {
  display: flex;
  justify-content: space-between;
  padding: var(--space-3) 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.project-nav a:hover { color: var(--terracotta-dark); }

/* ============================================
   JOURNAL / BLOG
   ============================================ */
.post-list { max-width: 760px; margin: 0 auto; }
.post-list article { padding: var(--space-4) 0; border-bottom: 1px solid var(--line); }
.post-list h2 { font-size: 1.7rem; }
.post-list h2 a:hover { color: var(--terracotta-dark); }
.post-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--olive-dark);
  margin-bottom: var(--space-2);
}
.entry-content { max-width: 720px; margin: 0 auto; }
.entry-content img { margin: var(--space-3) 0; }
.entry-content p { font-size: 1.05rem; }
.single-post .entry-header { text-align: center; padding: var(--space-5) 0 var(--space-3); }

.pagination {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: var(--space-4) 0;
}

/* ============================================
   PAGE (About, generic)
   ============================================ */
.page-header { text-align: center; padding: var(--space-5) 0 var(--space-3); }
.page-content { max-width: 720px; margin: 0 auto var(--space-5); }

/* ============================================
   CONTACT
   ============================================ */
.contact-wrap { max-width: 620px; margin: 0 auto var(--space-5); }
.form-row { margin-bottom: var(--space-3); }
.form-row label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  color: var(--ink-soft);
}
.form-row input,
.form-row textarea {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid var(--ink);
  background: var(--cream-light);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  border-radius: 2px;
}
.form-row textarea { resize: vertical; min-height: 140px; }
.form-honeypot { position: absolute; left: -9999px; }
.form-notice {
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
  border: 1px solid var(--olive);
  font-size: 0.95rem;
}
.form-notice.is-error { border-color: var(--terracotta-dark); }

/* ============================================
   SOCIAL BUTTONS (Contact page)
   ============================================ */
.social-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.social-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 1.3rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: background 0.15s ease, color 0.15s ease;
}
.social-btn svg { width: 18px; height: 18px; }
.social-btn:hover { background: var(--ink); color: var(--cream-light); }

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  border-top: 1px solid var(--line);
  padding: var(--space-4) 0;
  margin-top: var(--space-5);
}
.site-footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}
.footer-social { display: flex; gap: var(--space-3); align-items: center; }
.footer-social a { display: flex; }
.footer-social a svg { width: 18px; height: 18px; }
.footer-social a:hover { color: var(--terracotta-dark); }

/* ============================================
   SMALL SCREEN REFINEMENTS
   ============================================ */
@media (max-width: 560px) {
  body { font-size: 16px; }
  .container { padding: 0 1.1rem; }
  .grid-wrap { padding: 0 0.6rem; }
  .hero { padding: var(--space-4) 0 var(--space-4); }
  .hero h1 { font-size: clamp(2rem, 9vw, 2.8rem); }
  .section-heading { margin-bottom: var(--space-2); }
  .project-header,
  .page-header,
  .entry-header { padding: var(--space-4) 0 var(--space-2); }
}

/* ============================================
   404
   ============================================ */
.error-404 { text-align: center; padding: var(--space-6) 0; }
