/* =====================================================================
   Freelance Photographer Shimla — custom styles
   Tailwind (CDN) handles layout utilities; this file holds the design
   tokens, theme switching and the bespoke effects Tailwind can't express.
   ===================================================================== */

/* ---------- 1. Design tokens (RGB triplets for Tailwind alpha) -------- */
:root,
[data-theme="dark"] {
  --bg:      20 20 20;      /* deep charcoal  #141414 */
  --surface: 30 29 27;      /* lifted charcoal */
  --ink:     245 240 230;   /* soft ivory     #F5F0E6 */
  --muted:   176 168 155;   /* warm grey (AA on charcoal) */
  --accent:  197 160 89;    /* muted gold     #C5A059 */
  --line:    245 240 230;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg:      247 243 235;   /* warm cream */
  --surface: 255 252 246;
  --ink:     28 27 25;
  --muted:   98 91 81;
  --accent:  138 106 46;    /* deeper gold so text keeps AA contrast on cream */
  --line:    28 27 25;
  color-scheme: light;
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: rgb(var(--bg));
  color: rgb(var(--ink));
  transition: background-color .5s ease, color .5s ease;
  overflow-x: hidden;
}
::selection { background: #C5A059; color: #141414; }

/* Film-grain overlay – gives every page a tactile, printed feel */
body::after {
  content: ""; position: fixed; inset: -50%; z-index: 60; pointer-events: none;
  opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- 2. Typography helpers ----------------------------------- */
.eyebrow {
  font-family: Inter, system-ui, sans-serif;
  font-size: .7rem; font-weight: 500;
  letter-spacing: .32em; text-transform: uppercase;
  color: rgb(var(--accent));
}
.display { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 400; line-height: .98; letter-spacing: -.01em; }
.display em { font-style: italic; color: rgb(var(--accent)); }
.rule { height: 1px; background: rgb(var(--line) / .12); }
.hairline { border-color: rgb(var(--line) / .12); }

/* ---------- 3. Buttons ---------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .65rem;
  padding: 1rem 1.75rem; min-height: 48px;
  font-size: .72rem; font-weight: 500; letter-spacing: .24em; text-transform: uppercase;
  border-radius: 999px; transition: all .45s cubic-bezier(.2,.7,.1,1);
  white-space: nowrap;
}
.btn-gold { background: #C5A059; color: #141414; }
.btn-gold:hover { background: #d7b676; transform: translateY(-2px); box-shadow: 0 12px 30px -12px rgba(197,160,89,.6); }
.btn-ghost { border: 1px solid rgb(var(--line) / .28); color: rgb(var(--ink)); }
.btn-ghost:hover { border-color: rgb(var(--accent)); color: rgb(var(--accent)); }
.btn-ghost-light { border: 1px solid rgba(245,240,230,.4); color: #F5F0E6; }
.btn-ghost-light:hover { border-color: #C5A059; color: #C5A059; }
.btn .arrow { transition: transform .45s cubic-bezier(.2,.7,.1,1); }
.btn:hover .arrow { transform: translateX(4px); }

.link-underline { background: linear-gradient(currentColor,currentColor) 0 100% / 0 1px no-repeat; transition: background-size .5s cubic-bezier(.2,.7,.1,1); }
.link-underline:hover, .link-underline[aria-current="page"] { background-size: 100% 1px; }

/* ---------- 4. Glass-morphism --------------------------------------- */
.glass {
  background: rgb(var(--surface) / .55);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgb(var(--line) / .1);
}
.glass-dark {  /* always-dark glass, for use on top of photographs */
  background: rgba(20,20,20,.42);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(245,240,230,.14);
  color: #F5F0E6;
}

/* ---------- 5. Header ----------------------------------------------- */
#site-header .bar { transition: background-color .5s ease, padding .5s ease, border-color .5s ease; border-bottom: 1px solid transparent; }
#site-header.is-scrolled .bar {
  background: rgb(var(--bg) / .72);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-bottom-color: rgb(var(--line) / .08);
  padding-top: .85rem; padding-bottom: .85rem;
}
/* Over a dark hero, keep header text ivory until the user scrolls */
body.has-hero #site-header:not(.is-scrolled) .bar { color: #F5F0E6; }

#mobile-menu { transition: opacity .5s ease, visibility .5s; }
#mobile-menu[hidden] { display: block; opacity: 0; visibility: hidden; pointer-events: none; }
#mobile-menu a { transition: transform .6s cubic-bezier(.2,.7,.1,1), opacity .6s; }
#mobile-menu[hidden] a { transform: translateY(20px); opacity: 0; }

.menu-icon span { display:block; height:1px; width:24px; background: currentColor; transition: transform .4s ease, opacity .3s; }
.menu-icon span + span { margin-top: 7px; }
[aria-expanded="true"] .menu-icon span:first-child { transform: translateY(4px) rotate(45deg); }
[aria-expanded="true"] .menu-icon span:last-child  { transform: translateY(-4px) rotate(-45deg); }

/* ---------- 6. Hero -------------------------------------------------- */
.hero-img { animation: kenburns 22s ease-out both; transform-origin: 60% 40%; }
@keyframes kenburns { from { transform: scale(1.14); } to { transform: scale(1); } }
.hero-shade { background:
  linear-gradient(180deg, rgba(10,10,10,.55) 0%, rgba(10,10,10,.1) 35%, rgba(10,10,10,.25) 60%, rgba(10,10,10,.88) 100%); }
.scroll-cue { width:1px; height:56px; background: linear-gradient(rgba(245,240,230,.7), transparent); animation: cue 2.4s ease-in-out infinite; transform-origin: top; }
@keyframes cue { 0%{transform:scaleY(0)} 50%{transform:scaleY(1)} 100%{transform:scaleY(1); opacity:0} }

/* ---------- 7. Reveal on scroll ------------------------------------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 1.1s cubic-bezier(.2,.7,.1,1), transform 1.1s cubic-bezier(.2,.7,.1,1); transition-delay: var(--d, 0s); }
.reveal.is-visible { opacity: 1; transform: none; }
/* The clip goes on the child, not the observed element: IntersectionObserver
   treats a fully clipped target as invisible and would never fire. */
/* doubled class beats `.frame img` so the clip transition isn't overridden */
.reveal-mask.reveal-mask > * { clip-path: inset(0 0 100% 0); transition: clip-path 1.4s cubic-bezier(.7,0,.2,1), transform 1.4s cubic-bezier(.2,.7,.1,1), opacity .9s ease, filter .9s ease; transition-delay: var(--d,0s); }
.reveal-mask.is-visible.is-visible > * { clip-path: inset(0 0 0 0); }
.no-js .reveal, .no-js .reveal-mask > * { opacity: 1; transform: none; clip-path: none; }

/* ---------- 8. Images ----------------------------------------------- */
.frame { position: relative; overflow: hidden; background: rgb(var(--surface)); }
.frame img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.4s cubic-bezier(.2,.7,.1,1), opacity .9s ease, filter .9s ease; }
.frame img.lazy-fade { opacity: 0; filter: blur(8px); }
.frame img.is-loaded { opacity: 1; filter: none; }
.zoom:hover img, .zoom:focus-visible img { transform: scale(1.06); }
.frame .veil { position:absolute; inset:0; background: linear-gradient(180deg, transparent 45%, rgba(10,10,10,.75)); opacity: 0; transition: opacity .6s ease; }
.zoom:hover .veil, .zoom:focus-visible .veil { opacity: 1; }
.frame .meta { position:absolute; left:1.25rem; right:1.25rem; bottom:1.1rem; color:#F5F0E6; transform: translateY(10px); opacity:0; transition: all .6s cubic-bezier(.2,.7,.1,1); }
.zoom:hover .meta, .zoom:focus-visible .meta { transform:none; opacity:1; }
@media (hover: none) { .frame .veil, .frame .meta { opacity: 1; transform: none; } }

/* Masonry (portfolio page) — JS builds one .masonry-col per column and
   appends tiles left-to-right, so loading more never reshuffles tiles. */
.masonry { display: flex; gap: 1.25rem; align-items: flex-start; }
.masonry-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 1.25rem; }
.masonry-col > .frame:has(img:not(.is-loaded)) { min-height: 340px; } /* placeholder while loading */
@media (min-width: 1024px) { .masonry, .masonry-col { gap: 1.5rem; } }

/* Filter chips */
.chip { padding: .7rem 1.25rem; border-radius: 999px; font-size: .7rem; letter-spacing: .22em; text-transform: uppercase; border: 1px solid rgb(var(--line) / .16); color: rgb(var(--muted)); transition: all .35s ease; min-height: 44px; }
.chip:hover { color: rgb(var(--ink)); border-color: rgb(var(--line) / .4); }
.chip[aria-pressed="true"] { background: #C5A059; border-color: #C5A059; color: #141414; }

/* ---------- 9. Lightbox --------------------------------------------- */
.lightbox { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(8,8,8,.94); opacity: 0; visibility: hidden; transition: opacity .45s ease, visibility .45s; color: #F5F0E6; }
.lightbox.is-open { opacity: 1; visibility: visible; }
.lightbox figure { max-width: min(92vw, 1400px); width: 100%; display: flex; flex-direction: column; align-items: center; }
.lightbox img { max-height: 76vh; max-width: 100%; width: auto; object-fit: contain; box-shadow: 0 40px 80px -30px #000; transition: opacity .35s ease, transform .5s cubic-bezier(.2,.7,.1,1); }
.lightbox img.is-swapping { opacity: 0; transform: scale(.98); }
.lb-btn { position: absolute; width: 52px; height: 52px; border-radius: 999px; display: grid; place-items: center; border: 1px solid rgba(245,240,230,.25); transition: all .3s ease; background: rgba(20,20,20,.4); }
.lb-btn:hover { border-color: #C5A059; color: #C5A059; }

/* ---------- 10. Carousel -------------------------------------------- */
.carousel-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; scroll-behavior: smooth; }
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track > * { scroll-snap-align: start; flex: 0 0 100%; }
.dot { width: 28px; height: 2px; background: rgb(var(--line) / .2); transition: background .4s, width .4s; }
.dot[aria-current="true"] { background: rgb(var(--accent)); width: 48px; }

/* ---------- 11. FAQ accordion (<details>) ---------------------------- */
details.faq summary { list-style: none; cursor: pointer; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq .plus { transition: transform .45s cubic-bezier(.2,.7,.1,1); }
details.faq[open] .plus { transform: rotate(45deg); }
details.faq .answer { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .5s cubic-bezier(.2,.7,.1,1); }
details.faq[open] .answer { grid-template-rows: 1fr; }
details.faq .answer > div { overflow: hidden; }

/* ---------- 12. Forms ----------------------------------------------- */
.field { position: relative; }
.field input, .field select, .field textarea {
  width: 100%; background: transparent; color: rgb(var(--ink));
  border: 0; border-bottom: 1px solid rgb(var(--line) / .22);
  padding: 1.6rem 0 .7rem; font-size: 1rem; border-radius: 0;
  transition: border-color .35s ease;
}
.field select { appearance: none; cursor: pointer; }
.field select option { background: rgb(var(--surface)); color: rgb(var(--ink)); }
.field input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(.6); cursor: pointer; }
.field label { position: absolute; left: 0; top: 1.55rem; font-size: 1rem; color: rgb(var(--muted)); pointer-events: none; transition: all .3s ease; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-bottom-color: rgb(var(--accent)); }
.field input:focus + label, .field input:not(:placeholder-shown) + label,
.field textarea:focus + label, .field textarea:not(:placeholder-shown) + label,
.field.field-fixed label { top: .2rem; font-size: .68rem; letter-spacing: .22em; text-transform: uppercase; color: rgb(var(--accent)); }
.field .err { display: none; font-size: .75rem; color: #e08a7a; margin-top: .4rem; }
.field.invalid .err { display: block; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-bottom-color: #e08a7a; }

/* ---------- 13. Cursor follower (fine pointers only) ----------------- */
.cursor-dot, .cursor-ring { position: fixed; top: 0; left: 0; pointer-events: none; z-index: 90; border-radius: 999px; mix-blend-mode: difference; }
.cursor-dot  { width: 6px; height: 6px; background: #F5F0E6; margin: -3px 0 0 -3px; }
.cursor-ring { width: 38px; height: 38px; border: 1px solid #F5F0E6; margin: -19px 0 0 -19px; transition: width .35s ease, height .35s ease, margin .35s ease, opacity .3s; opacity: .6; }
.cursor-ring.is-hover { width: 74px; height: 74px; margin: -37px 0 0 -37px; opacity: 1; }
@media (hover: none), (pointer: coarse) { .cursor-dot, .cursor-ring { display: none; } }

/* ---------- 14. Marquee --------------------------------------------- */
.marquee { display: flex; width: max-content; animation: marquee 40s linear infinite; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- 15. Accessibility --------------------------------------- */
.skip-link { position: absolute; left: 1rem; top: -100px; z-index: 100; background: #C5A059; color: #141414; padding: .75rem 1.25rem; border-radius: 999px; font-size: .8rem; }
.skip-link:focus { top: 1rem; }
:focus-visible { outline: 2px solid #C5A059; outline-offset: 3px; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
  .reveal-mask.reveal-mask > * { clip-path: none; }
  .cursor-dot, .cursor-ring { display: none; }
}

/* Article body (journal) */
.prose-lux p { margin: 0 0 1.4rem; line-height: 1.85; color: rgb(var(--ink) / .86); }
.prose-lux h2 { font-family: "Cormorant Garamond", serif; font-size: 2rem; line-height: 1.1; margin: 3rem 0 1rem; }
.prose-lux ul { margin: 0 0 1.4rem 1.1rem; list-style: disc; color: rgb(var(--ink) / .86); line-height: 1.85; }
.prose-lux blockquote { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 1.75rem; line-height: 1.3; border-left: 1px solid #C5A059; padding-left: 1.5rem; margin: 2.5rem 0; }
