/* Prayatna website
   Layout: header, hero (headline + slideshow), work (six space cards), contact (business card).
   Colours come from the logo: warm grey and orange. Light theme by default, dark on request. */

/* ---------- tokens ---------- */
:root {
  --bg: #f8f7f6;
  --surface: #ffffff;
  --mist: #eeecea;
  --ink: #2c2928;
  --muted: #6f6866;
  --line: rgba(44, 41, 40, .11);
  --ember: #e2871d;        /* logo orange */
  --ember-ink: #a35705;    /* orange dark enough for text on light backgrounds */
  --tagline: #a35705;
  --glass: rgba(248, 247, 246, .84);
  --sans: "Jost", "Futura", "Century Gothic", "Helvetica Neue", Arial, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --r: 14px;
  color-scheme: light;
}

/* Dark theme: set by the switch in the header (data-mode="dark" on <html>). */
:root[data-mode="dark"] {
  --bg: #1c1a19;
  --surface: #252221;
  --mist: #2e2a29;
  --ink: #efeae5;
  --muted: #a69e98;
  --line: rgba(239, 234, 229, .12);
  --ember: #ef9836;
  --ember-ink: #f2a650;
  --tagline: #e9b46e;
  --glass: rgba(28, 26, 25, .82);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(env(safe-area-inset-top, 0px) + 76px);  /* anchors clear the sticky header */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  overflow-x: hidden;
  transition: background-color .4s, color .4s;
}

/* paints the notch area on phones in the page colour */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 60;
  background: var(--bg);
}

img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; }

h1, h2 { margin: 0; font-weight: 400; letter-spacing: -.03em; text-wrap: balance; }
.ser { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -.01em; color: var(--ember-ink); }

.wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding-left: max(16px, 4vw, env(safe-area-inset-left, 0px));
  padding-right: max(16px, 4vw, env(safe-area-inset-right, 0px));
}

/* ---------- logo ---------- */
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand .wm { display: flex; flex-direction: column; line-height: 1; }
.brand .wm b { font-weight: 400; font-size: 25px; letter-spacing: .01em; }
.brand .wm span { margin-top: 6px; font-size: 8.5px; font-weight: 500; letter-spacing: .32em; text-transform: uppercase; color: var(--tagline); }

.mark { height: 38px; width: auto; flex: none; overflow: visible; }
.mark .walls { fill: currentColor; }
.mark .door { transform-box: view-box; transform-origin: 66px 50px; transition: transform .7s cubic-bezier(.3, 1.4, .4, 1); }
.mark .arc { stroke-dasharray: 3.2 3; transition: opacity .4s; }
.mark.intro .door { animation: swing 1.2s .3s cubic-bezier(.3, 1.4, .4, 1) both; }  /* door opens on page load */
@keyframes swing { from { transform: rotate(-90deg); } to { transform: none; } }

/* ---------- header ---------- */
header.top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 50;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
header.top.scrolled { border-color: var(--line); }
header.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 14px; }

header nav { display: flex; align-items: center; gap: 6px; }
header nav a {
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  color: var(--muted);
  transition: color .2s, background .2s;
}
header nav a.on { color: var(--ink); background: var(--mist); }
header nav a.cta, header nav a.cta.on { padding-inline: 18px; background: var(--ember); color: #241a10; }

.theme {
  width: 44px;
  height: 44px;
  margin-left: 6px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .2s;
}
.theme svg { width: 19px; height: 19px; }
.theme .moon { display: none; }
:root[data-mode="dark"] .theme .sun { display: none; }
:root[data-mode="dark"] .theme .moon { display: block; }

/* ---------- hero ---------- */
.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
  padding-block: clamp(28px, 5vw, 64px) clamp(56px, 7vw, 96px);
}
.hero h1 { font-size: clamp(40px, 5.6vw, 84px); line-height: 1; }
.hero p { margin-top: 22px; max-width: 36ch; font-size: clamp(17px, 1.4vw, 19px); color: var(--muted); }

.load > * { animation: up .9s cubic-bezier(.2, .7, .2, 1) both; }
.load > *:nth-child(2) { animation-delay: .08s; }
@keyframes up { from { opacity: 0; transform: translateY(18px); } }

/* slideshow: photos cross-fade with a slow zoom */
.hero figure {
  position: relative;
  margin: 0;
  aspect-ratio: 3 / 2;
  max-width: 100%;
  overflow: hidden;
  border-radius: calc(var(--r) * 1.4);
  background: var(--mist);
  cursor: zoom-in;
  animation: unveil 1.2s cubic-bezier(.7, 0, .2, 1) both;
}
@keyframes unveil { from { clip-path: inset(0 0 0 100% round 20px); } to { clip-path: inset(0 round 20px); } }
.hero figure img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right bottom;  /* keeps the watermark corner in view */
  opacity: 0;
  transform: scale(1.07);
  transition: opacity 1.1s ease, transform 6s linear;
}
.hero figure img.on { opacity: 1; transform: scale(1); }
.hero figcaption {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 2;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-size: 13px;
  font-weight: 500;
}
.hdots {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.hdots button { all: unset; width: 8px; height: 8px; border-radius: 4px; background: var(--muted); opacity: .45; cursor: pointer; transition: width .35s, opacity .35s, background .35s; }
.hdots button[aria-current="true"] { width: 22px; opacity: 1; background: var(--ember); }
.hdots button:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }

/* ---------- work ---------- */
.work { padding-bottom: clamp(72px, 9vw, 128px); }
.work .head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-bottom: 26px;
  padding-top: clamp(40px, 5vw, 64px);
  border-top: 1px solid var(--line);
}
.work h2 { font-size: clamp(34px, 4vw, 56px); line-height: 1; }
.work .head p { font-size: 16px; color: var(--muted); }

/* one card per kind of space: hovering (or scrolling past on a phone) flips through its photos */
.spaces { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.space {
  all: unset;
  box-sizing: border-box;
  position: relative;
  isolation: isolate;
  aspect-ratio: 4 / 3;
  max-width: 100%;
  overflow: hidden;
  border-radius: var(--r);
  background: var(--mist);
  cursor: pointer;
}
.space img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right bottom;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity .6s ease, transform 1.2s cubic-bezier(.2, .7, .2, 1);
}
.space img.on { opacity: 1; transform: none; }
.space::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(180deg, transparent 45%, rgba(20, 18, 17, .72)); }
.space .meta { position: absolute; left: 18px; right: 30%; bottom: 16px; z-index: 2; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; color: #fff; }
.space .meta b { font-weight: 400; font-size: clamp(22px, 2vw, 28px); line-height: 1.1; letter-spacing: -.01em; }
.space .meta span { display: flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; opacity: .85; }
.space .meta span::after {
  content: "→";
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ember);
  color: #241a10;
  font-size: 14px;
  transition: transform .3s;
}
.space:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; }
.space:focus-visible .meta span::after { transform: translateX(3px); }
.space .dots { position: absolute; top: 14px; right: 14px; z-index: 2; display: flex; gap: 4px; }
.space .dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .5); transition: background .3s, width .3s; }
.space .dots i.on { width: 16px; border-radius: 3px; background: #fff; }

/* ---------- contact: the business card ---------- */
.contact { padding-bottom: clamp(40px, 6vw, 80px); }
.contact .head { margin-bottom: clamp(24px, 3vw, 36px); padding-top: clamp(40px, 5vw, 64px); border-top: 1px solid var(--line); }
.contact h2 { font-size: clamp(34px, 4vw, 56px); line-height: 1; }

.cards { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(16px, 3vw, 32px); }
.bc {
  position: relative;
  min-width: 0;
  max-width: 100%;
  aspect-ratio: 7 / 4;  /* business-card proportions */
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 24px 48px -24px rgba(30, 26, 24, .45);
  transition: box-shadow .5s;
}

.bc-front { display: grid; place-items: center; overflow: hidden; background: #5d5755; color: #fff; }
.bc-front::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 12px; background: #e2871d; }
.bc-front .lock { display: inline-flex; align-items: center; gap: clamp(12px, 1.6vw, 18px); }
.bc-front svg { height: clamp(54px, 6vw, 78px); width: auto; }
.bc-front .lock b { display: block; font-weight: 400; font-size: clamp(32px, 3.6vw, 48px); line-height: 1; letter-spacing: .01em; }
.bc-front .lock > span { display: block; }
.bc-front .lock b + span { display: block; margin-top: 10px; font-size: clamp(9px, .85vw, 11px); font-weight: 500; letter-spacing: .34em; text-transform: uppercase; color: #f6b56a; }

/* the back is printed on white card in both themes, so it resets the colour tokens locally */
.bc-back {
  --ink: #2c2928;
  --muted: #6f6866;
  --line: rgba(44, 41, 40, .12);
  --surface: #ffffff;
  --ember-ink: #a35705;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: clamp(12px, 1.6vw, 20px);
  padding: clamp(20px, 2.6vw, 32px);
  background: #fff;
  color: var(--ink);
}
.bc-back .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.bc-back .top svg { height: 36px; width: auto; flex: none; color: #5d5755; }
.bc-back .who b { display: block; font-weight: 400; font-size: clamp(24px, 2.4vw, 32px); line-height: 1.1; }
.bc-back .who span { display: block; margin-top: 6px; font-size: 12px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--ember-ink); }

.lines { display: grid; align-content: end; gap: 2px; }
.ln { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); }
.ln svg { width: 18px; height: 18px; color: var(--ember-ink); }
.ln .v { font-size: clamp(15px, 1.3vw, 17px); line-height: 1.4; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; text-decoration: none; }
.ln .acts { display: flex; gap: 6px; }

.mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.mini.ok { background: var(--ember); border-color: var(--ember); color: #241a10; }

/* ---------- footer ---------- */
footer .wrap { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding-block: 26px 32px; font-size: 14px; color: var(--muted); }

/* ---------- photo viewer ---------- */
dialog.lb {
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: var(--bg);
  color: var(--ink);
  overscroll-behavior: contain;
}
dialog.lb::backdrop { background: rgba(0, 0, 0, .3); }
dialog.lb[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; animation: fade .25s; }
@keyframes fade { from { opacity: 0; } }

.lb-top, .lb-bot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px));
}
.lb-top { padding-top: max(16px, env(safe-area-inset-top, 0px)); }
.lb-bot { padding-bottom: max(16px, env(safe-area-inset-bottom, 0px)); }
.lb-fig { display: grid; place-items: center; min-height: 0; margin: 0; padding: 0 76px; }
.lb-fig img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--r); animation: fade .35s; }
.lb .ix { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb .cap { font-size: 17px; }
.lb .cat { font-size: 13px; color: var(--ember-ink); }

.thumbs { display: flex; gap: 8px; max-width: 60%; padding: 3px; overflow-x: auto; scrollbar-width: none; }
.thumbs::-webkit-scrollbar { display: none; }
.thumbs button { all: unset; flex: none; width: 64px; height: 46px; overflow: hidden; border-radius: 8px; opacity: .5; cursor: pointer; transition: opacity .25s, box-shadow .25s; }
.thumbs button img { width: 100%; height: 100%; object-fit: cover; }
.thumbs button[aria-current="true"] { opacity: 1; box-shadow: 0 0 0 2px var(--ember); }
.thumbs button:focus-visible { opacity: 1; outline: 2px solid var(--ember); outline-offset: 2px; }

.circ {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  font-size: 18px;
  cursor: pointer;
  transition: border-color .2s;
}
.lb .nav { position: absolute; top: 50%; transform: translateY(-50%); }
.lb .prev { left: max(16px, env(safe-area-inset-left, 0px)); }
.lb .next { right: max(16px, env(safe-area-inset-right, 0px)); }

/* ---------- hover effects (mouse and trackpad only, so they never stick after a tap) ---------- */
@media (hover: hover) {
  .brand:hover .mark .door { transform: rotate(-90deg); }
  .brand:hover .mark .arc { opacity: 0; }
  header nav a:hover { color: var(--ink); background: var(--mist); }
  header nav a.cta:hover { background: var(--ink); color: var(--bg); }
  .theme:hover, .circ:hover, .mini:hover { border-color: var(--ink); }
  .space:hover .meta span::after { transform: translateX(3px); }
  .cards:hover .bc { box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 36px 60px -28px rgba(30, 26, 24, .5); }
  .thumbs button:hover { opacity: .85; }
}

/* ---------- tablets ---------- */
@media (max-width: 960px) {
  .cards { grid-template-columns: 1fr; max-width: 560px; margin-inline: auto; }
  .bc-back { order: -1; aspect-ratio: auto; }  /* contact details first */
}
@media (max-width: 900px) {
  .spaces { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; padding-block: 20px 56px; }
}

/* ---------- phones ---------- */
@media (max-width: 640px) {
  .thumbs { display: none; }
  .lb-fig { padding: 0 8px; }
  .lb-bot { padding-right: 130px; }
  .lb .nav { top: auto; bottom: max(16px, env(safe-area-inset-bottom, 0px)); transform: none; }
  .lb .prev { left: auto; right: calc(max(16px, env(safe-area-inset-right, 0px)) + 54px); }
}
@media (max-width: 540px) {
  .spaces { grid-template-columns: 1fr; }
  .space { aspect-ratio: 16 / 10; }
}
@media (max-width: 520px) {
  header.top .wrap { padding-block: 10px; }
  header nav a { padding: 10px; }
  header nav a.cta { padding-inline: 14px; }
  .brand .wm b { font-size: 23px; }
  .brand .wm span { display: none; }
  .mark { height: 34px; }
}
@media (max-width: 420px) {
  .ln { grid-template-columns: 20px minmax(0, 1fr); }
  .ln .acts { grid-column: 2; }
  .bc-front .lock b { font-size: 30px; }
}
@media (max-width: 380px) {
  .brand { gap: 8px; }
  .brand .wm b { font-size: 20px; }
  .mark { height: 30px; }
  header nav { gap: 4px; }
  header nav a { padding: 8px; font-size: 14px; }
  .theme { width: 40px; height: 40px; margin-left: 2px; }
}

/* ---------- theme switch: the new theme spreads out from the button (see js/main.js) ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

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