/* ============================================================
   Mira Kaelo · Photography
   Warm earth editorial · Broken bento · Staggered line reveal
   ============================================================ */

/* --- RESET --- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  font-family: 'DM Sans', 'Inter', system-ui, sans-serif;
  font-size: 1.05rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

/* --- CUSTOM PROPERTIES (light default) --- */
:root {
  --bg: #f5efe4;
  --ink: #2b1e14;
  --accent: #c25a37;
  --secondary: #6a7a4a;
  --card-bg: #ede5d6;
  --border: #d9cfbc;
  --muted: #8a7a6a;
  --grain-opacity: 0.06;
}

/* --- DARK MODE --- */
[data-theme="dark"] {
  --bg: #1a1410;
  --ink: #e8ddd0;
  --accent: #d97a55;
  --secondary: #8a9a5a;
  --card-bg: #241e18;
  --border: #3a3028;
  --muted: #9a8a7a;
  --grain-opacity: 0.08;
}

@media (prefers-color-scheme: dark) and (prefers-color-scheme: no-preference) {
  :root:not([data-theme]) {
    --bg: #1a1410;
    --ink: #e8ddd0;
    --accent: #d97a55;
    --secondary: #8a9a5a;
    --card-bg: #241e18;
    --border: #3a3028;
    --muted: #9a8a7a;
    --grain-opacity: 0.08;
  }
}

body {
  background: var(--bg);
  color: var(--ink);
  transition: background 0.3s, color 0.3s;
}

/* --- GRAIN OVERLAY --- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: var(--grain-opacity);
  pointer-events: none;
  z-index: 9999;
}

/* --- ATTRIBUTION (free tier) --- */
.attribution {
  position: fixed;
  bottom: 0.5rem;
  right: 0.75rem;
  font-size: 0.7rem;
  opacity: 0.4;
  z-index: 10000;
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--muted);
}
.attribution a { color: inherit; }
.attribution a:hover { color: var(--accent); }

/* --- TYPOGRAPHY --- */
h1, h2, h3, h4 {
  font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
}

/* --- HEADER --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  background: rgba(245, 239, 228, 0.85);
  transition: background 0.3s;
}
[data-theme="dark"] .site-header,
@media (prefers-color-scheme: dark) {
  .site-header {
    background: rgba(26, 20, 16, 0.85);
  }
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.site-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.site-nav {
  display: flex;
  gap: 2rem;
}
.nav-link {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  transition: color 0.2s;
  position: relative;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s;
}
.nav-link:hover { color: var(--accent); }
.nav-link:hover::after { width: 100%; }

/* --- HERO --- */
.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 6rem 2rem 4rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 3rem;
}
.hero-content {
  flex: 1;
}
.hero-eyebrow {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 1rem;
}
.hero-headline {
  font-size: clamp(2.8rem, 7vw, 5rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin: 0 0 1.5rem;
}
.hero-sub {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0;
}
.hero-mark {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
}
.hero-accent-line {
  display: block;
  width: 4px;
  height: 120px;
  background: var(--accent);
  border-radius: 2px;
}

/* --- SECTION LABEL --- */
.section-label {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
}
.label-line {
  display: block;
  width: 2rem;
  height: 2px;
  background: var(--accent);
}
.label-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-style: italic;
  color: var(--muted);
  text-transform: lowercase;
}

/* --- WORK / BENTO GRID --- */
.work {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 2rem;
}
.bento-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1.5rem;
}
.bento-item {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  transition: transform 0.3s, box-shadow 0.3s;
}
.bento-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.bento-img {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  position: relative;
}
.bento-img-inner {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  transition: transform 0.5s;
}
.bento-item:hover .bento-img-inner {
  transform: scale(1.05);
}
.bento-item figcaption {
  padding: 1rem 1.25rem 1.25rem;
}
.work-title {
  font-size: 1.15rem;
  margin-bottom: 0.3rem;
}
.work-desc {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
  line-height: 1.5;
}
.work-meta {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

/* Bento spans — asymmetric anti-grid */
.item-1 {
  grid-column: 1 / 4;
  grid-row: 1 / 3;
}
.item-1 .bento-img { aspect-ratio: 4 / 3; }

.item-2 {
  grid-column: 4 / 7;
  grid-row: 1 / 2;
}
.item-2 .bento-img { aspect-ratio: 16 / 9; }

.item-3 {
  grid-column: 4 / 7;
  grid-row: 2 / 4;
}
.item-3 .bento-img { aspect-ratio: 4 / 3; }

.item-4 {
  grid-column: 1 / 3;
  grid-row: 3 / 4;
}
.item-4 .bento-img { aspect-ratio: 1 / 1; }

.item-5 {
  grid-column: 3 / 5;
  grid-row: 4 / 5;
}
.item-5 .bento-img { aspect-ratio: 16 / 9; }

.empty-cell {
  grid-column: 5 / 7;
  grid-row: 4 / 5;
  background: transparent;
  border: 1px dashed var(--border);
  min-height: 0;
  pointer-events: none;
}

/* --- ABOUT --- */
.about {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 2rem;
}
.about-body {
  max-width: 72ch;
}
.about-body p {
  margin: 0 0 1.2rem;
  font-size: 1.05rem;
}
.about-body em {
  font-style: italic;
  color: var(--accent);
}

/* --- APPROACH --- */
.approach {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 2rem;
}
.approach-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}
.approach-card {
  padding: 2rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: transform 0.3s;
}
.approach-card:hover {
  transform: translateY(-3px);
}
.approach-heading {
  font-size: 1.3rem;
  margin-bottom: 0.8rem;
  color: var(--accent);
}
.approach-card p {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}

/* --- CONTACT --- */
.contact {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 2rem 6rem;
}
.contact-body {
  max-width: 64ch;
}
.contact-line {
  font-size: 1.1rem;
  margin: 0 0 1.5rem;
}
.contact-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.5rem;
  margin-bottom: 2rem;
  font-size: 0.95rem;
  color: var(--muted);
}
.contact-email {
  color: var(--accent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.contact-email:hover {
  border-color: var(--accent);
}

/* --- FORM --- */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.form-row {
  display: flex;
  gap: 1rem;
}
.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.95rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--ink);
  transition: border-color 0.2s;
}
.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.contact-form input::placeholder,
.contact-form textarea::placeholder {
  color: var(--muted);
  opacity: 0.7;
}
.form-submit {
  align-self: flex-start;
  padding: 0.8rem 2rem;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.form-submit:hover {
  background: #b04a2a;
  transform: translateY(-1px);
}
.form-submit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.form-status {
  font-size: 0.9rem;
  color: var(--secondary);
  margin: 0;
}

/* --- FOOTER --- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
}
.footer-copy { margin: 0; }
.footer-tagline { margin: 0; }

/* --- STAGGERED LINE REVEAL (CSS scroll-driven) --- */
@keyframes riseIn {
  from {
    opacity: 0;
    translate: 0 20px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}

.about p,
.approach-card,
.contact-body > p,
.contact-details,
.contact-form {
  animation: riseIn linear both;
  animation-timeline: view();
  animation-range: entry 0% cover 40%;
}

.bento-item {
  animation: riseIn linear both;
  animation-timeline: view();
  animation-range: entry 0% cover 35%;
}

/* --- RESPONSIVE --- */
@media (max-width: 900px) {
  .bento-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  .item-1 { grid-column: 1 / 3; grid-row: auto; }
  .item-2 { grid-column: 1 / 2; grid-row: auto; }
  .item-3 { grid-column: 2 / 3; grid-row: auto; }
  .item-4 { grid-column: 1 / 2; grid-row: auto; }
  .item-5 { grid-column: 2 / 3; grid-row: auto; }
  .empty-cell { display: none; }
  .approach-grid {
    grid-template-columns: 1fr;
  }
  .hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 4rem 2rem 2rem;
  }
  .hero-accent-line { height: 60px; }
  .form-row {
    flex-direction: column;
  }
}

@media (max-width: 600px) {
  .bento-grid {
    grid-template-columns: 1fr;
  }
  .item-1, .item-2, .item-3, .item-4, .item-5 {
    grid-column: 1 / 2;
  }
  .header-inner {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
  }
  .site-nav {
    gap: 1rem;
  }
  .hero-headline {
    font-size: 2.2rem;
  }
  .contact-details {
    flex-direction: column;
    gap: 0.3rem;
  }
  .footer-inner {
    flex-direction: column;
    gap: 0.3rem;
    text-align: center;
  }
}

/* --- REDUCED MOTION --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .bento-item:hover {
    transform: none;
  }
  .bento-item:hover .bento-img-inner {
    transform: none;
  }
  .approach-card:hover {
    transform: none;
  }
  .form-submit:hover {
    transform: none;
  }
  html { scroll-behavior: auto; }
}
