/* ============================================================
   HIMANSHU MISHRA — "The Instrument Maker"
   Viewport-locked panels · lateral navigation · data-as-art
   Identity: the gauge, the calibration tick, measured warmth.
   ============================================================ */

:root {
  /* Deep oxblood ground — controlled aggression */
  --bg:        #2a0f12;   /* deep maroon / oxblood */
  --bg-2:      #351619;   /* raised maroon panel */
  --panel:     #3a181b;   /* card face */
  --paper:     #f3e7d8;   /* warm bone — primary text on dark */
  --paper-2:   #e4d4c0;
  --ink:       #1c0a0c;   /* darkest — button fills */
  --accent:    #e0613f;   /* bright ember — needle, CTAs */
  --accent-lt: #f0795a;
  --brass:     #d7a85c;   /* calibrated gold, brightened for maroon */
  --brass-lt:  #ecc079;
  --muted:     #c49b97;   /* warm rose-grey — body/secondary text */
  --muted-d:   #9a6f6c;   /* dimmer warm rose — captions */
  --line:      #4a2226;   /* warm maroon hairline */
  --line-lt:   #d8c4ad;

  --display: "Fraunces", Georgia, serif;
  --body:    "Inter", system-ui, sans-serif;
  --mono:    "Space Mono", monospace;

  --ease: cubic-bezier(0.6, 0.01, 0.05, 1);
  --nav-h: 76px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--paper);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;          /* never scroll sideways */
  overflow-y: auto;            /* allow vertical scroll as a safety net at any zoom */
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
svg { display: block; }

/* The frame targets one screen but never traps content: min-height, not fixed */
.frame { min-height: 100vh; display: flex; flex-direction: column; }
.stage { flex: 1 1 auto; min-height: 0; position: relative; }

/* On smaller screens we must allow scroll — honesty over dogma */
@media (max-width: 880px), (max-height: 620px) {
  body { overflow-y: auto; }
}

/* ---------- Page transition veil ---------- */
.veil {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  background: var(--accent);
  clip-path: inset(0 0 100% 0);
}
.veil.in  { animation: veilIn  0.5s var(--ease) forwards; pointer-events: all; }
.veil.out { animation: veilOut 0.6s var(--ease) forwards; }
@keyframes veilIn  { from { clip-path: inset(0 0 100% 0);} to { clip-path: inset(0 0 0 0);} }
@keyframes veilOut { from { clip-path: inset(0 0 0 0);}    to { clip-path: inset(100% 0 0 0);} }

/* ---------- Frame: fixed nav + stage ---------- */
/* .frame and .stage defined above with min-height model */

.nav {
  height: var(--nav-h); flex: 0 0 var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 36px; border-bottom: 1px solid var(--line);
  background: var(--bg); position: relative; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand .mk { width: 34px; height: 34px; color: var(--paper); transition: transform 0.6s var(--ease); }
.brand:hover .mk { transform: rotate(-18deg); }
.brand .nm { font-family: var(--display); font-size: 1.22rem; letter-spacing: -0.01em; line-height: 1; }
.brand .nm small { display: block; font-family: var(--mono); font-size: 0.56rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--brass); margin-top: 3px; }

.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-links a {
  font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 9px 15px; border-radius: 2px; position: relative; color: var(--muted);
  transition: color 0.3s, background 0.3s;
}
.nav-links a:hover { color: var(--paper); }
.nav-links a.active { color: var(--paper); }
.nav-links a.active::before {
  content: ""; position: absolute; left: 15px; right: 15px; bottom: 3px; height: 2px; background: var(--accent);
}
.nav-cta {
  font-family: var(--mono); font-size: 0.74rem !important; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 10px 18px !important; border: 1px solid var(--brass); border-radius: 2px; color: var(--brass) !important;
  margin-left: 10px; overflow: hidden; position: relative; isolation: isolate;
}
.nav-cta::after { content:""; position:absolute; inset:0; background:var(--brass); transform: translateY(101%); transition: transform 0.4s var(--ease); z-index:-1; }
.nav-cta:hover { color: var(--ink) !important; }
.nav-cta:hover::after { transform: translateY(0); }

.burger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; }
.burger span { width: 24px; height: 2px; background: var(--paper); transition: 0.3s; }

/* ---------- Stage (targets one screen, expands if content needs it) ---------- */
.stage { flex: 1 1 auto; position: relative; display: flex; flex-direction: column; }
.stage.scrollable { display: block; }
.panel-enter { animation: panelEnter 0.7s var(--ease) both; }
@keyframes panelEnter { from { opacity: 0; transform: translateY(14px);} to { opacity:1; transform:none;} }

/* item stagger */
.st { opacity: 0; transform: translateY(16px); animation: stIn 0.7s var(--ease) forwards; }
@keyframes stIn { to { opacity: 1; transform: none; } }
.st.d1{animation-delay:.08s}.st.d2{animation-delay:.16s}.st.d3{animation-delay:.24s}
.st.d4{animation-delay:.32s}.st.d5{animation-delay:.40s}.st.d6{animation-delay:.48s}

@media (prefers-reduced-motion: reduce) {
  *, .st { animation: none !important; transition: none !important; opacity: 1 !important; transform: none !important; }
}

/* ---------- Shared bits ---------- */
.eyebrow { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--brass); display: inline-flex; align-items: center; gap: 8px; }
.eyebrow::before { content: ""; width: 22px; height: 1px; background: var(--brass); }
h1,h2,h3 { font-family: var(--display); font-weight: 400; line-height: 1.02; letter-spacing: -0.018em; }

.btn {
  --bg-b: var(--accent); --fg-b: var(--paper);
  position: relative; display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 15px 26px; border: 1px solid var(--bg-b); border-radius: 2px;
  background: var(--bg-b); color: var(--fg-b); cursor: pointer; overflow: hidden; isolation: isolate;
  transition: color .35s var(--ease), transform .12s var(--ease), box-shadow .35s var(--ease);
}
.btn::before { content:""; position:absolute; inset:0; z-index:-1; background: var(--ink); transform: translateX(-101%); transition: transform .42s var(--ease); }
.btn:hover { box-shadow: 0 12px 28px -12px rgba(181,71,45,.6); }
.btn:hover::before { transform: translateX(0); }
.btn:active { transform: scale(.96); }
.btn .ar { transition: transform .35s var(--ease); }
.btn:hover .ar { transform: translateX(5px); }
.btn.ghost { --bg-b: transparent; --fg-b: var(--paper); border-color: var(--line-lt); }
.btn.ghost::before { background: var(--paper); }
.btn.ghost:hover { color: var(--ink); }
.btn.dark { --bg-b: var(--ink); --fg-b: var(--paper); border-color: var(--ink); }
.btn.dark::before { background: var(--accent); }

.ripple { position:absolute; border-radius:50%; background: rgba(255,255,255,.4); transform: scale(0); animation: rip .6s var(--ease); pointer-events:none; }
@keyframes rip { to { transform: scale(4); opacity: 0; } }

/* ============================================================
   HOME PANEL
   ============================================================ */
.home {
  flex: 1; min-height: calc(100vh - var(--nav-h)); display: grid; grid-template-columns: 1.15fr 0.85fr;
}
.home-left { padding: clamp(36px, 5vh, 72px) clamp(36px, 5vw, 90px); display: flex; flex-direction: column; justify-content: center; position: relative; gap: 0; }
.home-left h1 { font-size: clamp(2.4rem, 5vw, 4.4rem); max-width: 14ch; }
.home-left h1 .em { font-style: italic; color: var(--brass-lt); }
.home-left .lead { font-size: clamp(1rem, 1.4vw, 1.18rem); color: var(--muted); max-width: 46ch; margin: 24px 0 30px; }
.home-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.home-foot { margin-top: clamp(20px, 3vh, 36px); font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; color: var(--muted-d); text-transform: uppercase; }

/* right: the instrument */
.home-right { background: var(--bg-2); border-left: 1px solid var(--line); position: relative; overflow: hidden; display: grid; place-items: center; }
.instrument { width: min(86%, 460px); aspect-ratio: 1; position: relative; }
.readout { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.readout .big { font-family: var(--display); font-size: clamp(2.4rem, 5vw, 4rem); color: var(--paper); line-height: 1; }
.readout .cap { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--brass); margin-top: 8px; text-align: center; }
.metric-strip { position: absolute; left: 0; right: 0; bottom: 28px; display: flex; justify-content: center; gap: 30px; }
.metric-strip .m { text-align: center; }
.metric-strip .m .v { font-family: var(--display); font-size: 1.5rem; color: var(--brass-lt); line-height: 1; }
.metric-strip .m .l { font-family: var(--mono); font-size: 0.56rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-top: 5px; }

/* ============================================================
   GENERIC CONTENT PANEL (services / about / contact)
   ============================================================ */
.panel-pad { flex: 1; min-height: calc(100vh - var(--nav-h)); padding: clamp(34px, 5vh, 64px) clamp(36px, 5vw, 90px); display: flex; flex-direction: column; }
.panel-head { margin-bottom: clamp(20px, 3vh, 38px); }
.panel-head h2 { font-size: clamp(1.9rem, 3.6vw, 3rem); margin-top: 14px; max-width: 20ch; }
.panel-head .sub { color: var(--muted); max-width: 56ch; margin-top: 12px; font-size: 1.02rem; }

/* Services as a 2x3 instrument grid */
.svc-board { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, auto); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 4px; overflow: clip; }
.svc-cell { background: var(--panel); padding: clamp(20px,2.4vh,30px); display: flex; flex-direction: column; position: relative; transition: background 0.35s; cursor: default; }
.svc-cell:hover { background: var(--bg-2); }
.svc-cell .n { font-family: var(--mono); font-size: 0.66rem; color: var(--brass); letter-spacing: 0.14em; }
.svc-cell h3 { font-size: clamp(1.05rem, 1.6vw, 1.4rem); margin: 10px 0 8px; transition: color 0.3s; }
.svc-cell:hover h3 { color: var(--accent-lt); }
.svc-cell p { font-size: 0.85rem; color: var(--muted); line-height: 1.5; flex: 1; }
.svc-cell .tg { margin-top: 10px; font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.06em; color: var(--muted-d); text-transform: uppercase; }
.svc-cell::after { content:""; position:absolute; left:0; top:0; width:3px; height:0; background: var(--accent); transition: height 0.4s var(--ease); }
.svc-cell:hover::after { height: 100%; }

/* About: split — dossier left, ledger right */
.dossier { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: clamp(30px,4vw,64px); align-items: center; }
.dossier .bio { display: flex; flex-direction: column; justify-content: center; }
.dossier .bio p { color: var(--paper); font-size: clamp(0.95rem,1.25vw,1.1rem); line-height: 1.5; margin-bottom: 14px; max-width: 46ch; }
.dossier .bio p.q { font-family: var(--display); font-style: italic; font-size: clamp(1.2rem,1.9vw,1.6rem); color: var(--brass-lt); border-left: 2px solid var(--brass); padding-left: 18px; line-height: 1.28; margin-bottom: 18px; }
.ledger { border-left: 1px solid var(--line); padding-left: clamp(24px,3vw,48px); display: flex; flex-direction: column; justify-content: center; }
.ledger-row { padding: 10px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: baseline; }
.ledger-row:last-child { border-bottom: none; }
.ledger-row .yr { font-family: var(--mono); font-size: 0.68rem; color: var(--brass); letter-spacing: 0.06em; white-space: nowrap; }
.ledger-row .role { font-family: var(--display); font-size: 1.04rem; }
.ledger-row .org { font-size: 0.8rem; color: var(--muted); }

/* Contact: card on instrument bg */
.contact-wrap { flex: 1; display: grid; grid-template-columns: 0.9fr 1.1fr; gap: clamp(30px,4vw,60px); align-items: center; }
.contact-info { display: flex; flex-direction: column; justify-content: center; }
.ci-row { padding: 14px 0; border-top: 1px solid var(--line); }
.ci-row:first-of-type { border-top: none; }
.ci-row .k { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--brass); }
.ci-row .v { font-size: 1.05rem; margin-top: 4px; }
.ci-row a:hover { color: var(--accent-lt); }
.cform { display: flex; flex-direction: column; justify-content: center; }
.cform .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fld { margin-bottom: 13px; }
.fld label { display: block; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.fld input, .fld textarea, .fld select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 2px;
  font-family: var(--body); font-size: 0.95rem; background: var(--bg-2); color: var(--paper); transition: border-color .3s, box-shadow .3s;
}
.fld textarea { resize: none; min-height: 64px; }
.fld input:focus, .fld textarea:focus, .fld select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(181,71,45,.16); }
.form-msg { font-family: var(--mono); font-size: 0.78rem; margin-top: 10px; min-height: 18px; }

/* ============================================================
   JOURNAL PANEL — index as a "reading table"
   ============================================================ */
.journal-board { flex: 1; display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.j-feature { background: var(--panel); padding: clamp(24px,3vw,40px); display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.j-feature::after { content:"❝"; position:absolute; right:18px; bottom:-30px; font-family:var(--display); font-size:9rem; color: rgba(194,149,74,.12); }
.j-feature .cat { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--brass); }
.j-feature h3 { font-size: clamp(1.4rem,2.4vw,2.1rem); margin: 14px 0; max-width: 16ch; }
.j-feature p { color: var(--muted); font-size: 0.92rem; max-width: 38ch; }
.j-col { display: grid; grid-template-rows: repeat(3, 1fr); }
.j-item { background: var(--panel); padding: clamp(14px,1.8vh,20px) clamp(16px,1.6vw,24px); border-bottom: 1px solid var(--line); transition: background .3s; display: flex; flex-direction: column; justify-content: center; position: relative; }
.j-col:last-child .j-item { border-left: 0; }
.j-item:last-child { border-bottom: none; }
.j-item:hover { background: var(--bg-2); }
.j-item .cat { font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--brass); }
.j-item h4 { font-family: var(--display); font-size: clamp(1rem,1.4vw,1.18rem); font-weight: 400; margin: 6px 0; line-height: 1.12; transition: color .3s; }
.j-item:hover h4 { color: var(--accent-lt); }
.j-item .rd { font-family: var(--mono); font-size: 0.6rem; color: var(--muted-d); }

/* ============================================================
   ARTICLE PAGE — this one scrolls (long-form is allowed to)
   ============================================================ */
.reader { min-height: calc(100vh - var(--nav-h)); }
.reader-inner { max-width: 680px; margin: 0 auto; padding: clamp(40px,6vh,80px) 28px 90px; }
.reader .cat { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-lt); }
.reader h1 { font-size: clamp(2rem,4.5vw,3.2rem); margin: 16px 0; }
.reader .meta { font-family: var(--mono); font-size: 0.74rem; color: var(--muted); padding-bottom: 30px; border-bottom: 1px solid var(--line); margin-bottom: 36px; }
.reader-body { font-size: 1.1rem; line-height: 1.78; color: #e9d9c8; }
.reader-body p { margin-bottom: 24px; }
.reader-body h2 { font-family: var(--display); font-size: 1.7rem; color: var(--paper); margin: 42px 0 16px; }
.reader-body h3 { font-family: var(--display); font-size: 1.3rem; color: var(--brass-lt); margin: 32px 0 12px; }
.reader-body ul.b { margin: 0 0 24px; }
.reader-body ul.b li { position: relative; padding-left: 26px; margin-bottom: 11px; }
.reader-body ul.b li::before { content: "›"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.reader-body blockquote { border-left: 3px solid var(--brass); padding: 6px 0 6px 24px; margin: 32px 0; font-family: var(--display); font-style: italic; font-size: 1.4rem; line-height: 1.4; color: var(--paper); }
.reader-body em { color: var(--brass-lt); font-style: italic; }
.reader-body strong { color: var(--paper); font-weight: 600; }
.reader-back { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--brass); margin-bottom: 30px; }
.reader-back:hover { color: var(--accent-lt); }

/* ---------- Newsletter inline (compact, used on home-right & contact) ---------- */
.mini-news { width: 100%; }
.mini-news .nf { display: flex; gap: 8px; margin-top: 12px; }
.mini-news input { flex: 1; padding: 11px 13px; border: 1px solid var(--line); background: var(--bg-2); color: var(--paper); font-size: 0.9rem; border-radius: 2px; }
.mini-news input:focus { outline: none; border-color: var(--brass); }

/* ---------- Mobile ---------- */
@media (max-width: 880px), (max-height: 620px) {
  body { overflow-y: auto; }
  .stage { overflow: visible; }
  .home { grid-template-columns: 1fr; height: auto; }
  .home-left { min-height: 70vh; }
  .home-right { min-height: 60vh; border-left: none; border-top: 1px solid var(--line); }
  .home-foot { position: static; margin-top: 24px; }
  .svc-board { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
  .dossier, .contact-wrap, .journal-board { grid-template-columns: 1fr; }
  .journal-board { grid-template-rows: auto; }
  .j-col { grid-template-rows: auto; }
  .ledger { border-left: none; border-top: 1px solid var(--line); padding-left: 0; padding-top: 20px; }
  .panel-pad { height: auto; }
}
@media (max-width: 640px) {
  .nav { padding: 0 18px; }
  .nav-links { position: fixed; top: var(--nav-h); left: 0; right: 0; background: var(--bg-2); flex-direction: column; align-items: stretch; padding: 14px; gap: 4px; transform: translateY(-130%); transition: transform .4s var(--ease); border-bottom: 1px solid var(--line); z-index: 40; }
  .nav-links.open { transform: translateY(0); }
  .nav-links a { padding: 12px 14px; }
  .burger { display: flex; }
  .svc-board { grid-template-columns: 1fr; }
  .cform .grid2 { grid-template-columns: 1fr; }
  .metric-strip { gap: 18px; }
}
