/* ==========================================================================
   TVIARA STUDIO — components.css
   Header · Nav · Buttons · Links · Cards · Tabs · Cursor · Footer
   Section-level component styling lives in pages.css (Phase 5)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. HEADER + NAVIGATION
   Light by default; subtle blur + hairline appear only after scroll.
   -------------------------------------------------------------------------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  --header-fg: var(--ivory);          /* light over the hero by default */
  transition:
    background-color var(--dur-fast) var(--ease),
    backdrop-filter var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease);
  border-bottom: 1px solid transparent;
}
.site-header.is-scrolled {
  --header-fg: var(--ebony);          /* dark on the parchment bar */
  background: rgba(254, 246, 230, 0.82);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom-color: var(--line);
}
/* Inner pages open on parchment, not a dark hero — header text is dark
   immediately, and turns to the solid blurred bar once scrolled. */
.inner-page .site-header { --header-fg: var(--ebony); }

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  line-height: 0;
}
/* Mark swap: champagne over hero, bronze once scrolled */
.brand__mark {
  position: relative;
  width: auto;
  height: 38px;
}
.brand__mark img {
  height: 38px;
  width: auto;
  transition: opacity var(--dur-fast) var(--ease);
}
.brand__mark .mark-dark { position: absolute; inset: 0; opacity: 0; }
.site-header.is-scrolled .brand__mark .mark-light { opacity: 0; }
.site-header.is-scrolled .brand__mark .mark-dark  { opacity: 1; }
.inner-page .brand__mark .mark-light { opacity: 0; }
.inner-page .brand__mark .mark-dark  { opacity: 1; }
.brand .brand-word {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--header-fg);
  transition: color var(--dur-fast) var(--ease);
}

/* Primary nav */
.nav {
  display: flex;
  align-items: center;
  gap: clamp(1.5rem, 3vw, 3rem);
}
.nav a {
  font-family: var(--font-ui);
  font-weight: 300;
  font-size: var(--fs-small);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  position: relative;
  padding-block: 0.5rem;
  color: var(--header-fg);
  transition: color var(--dur-fast) var(--ease);
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0.15rem;
  width: 0; height: 1px;
  background: var(--champagne);
  transition: width var(--dur-fast) var(--ease);
}
.nav a:hover::after,
.nav a:focus-visible::after,
.nav a[aria-current="page"]::after { width: 100%; }
.nav a[aria-current="page"] {
  color: var(--champagne);
  font-weight: 400;
}
.nav a[aria-current="page"]::after { height: 2px; }
/* On light inner pages, keep the active link champagne but a touch deeper for contrast */
.inner-page .nav a[aria-current="page"] { color: var(--accent-deep); }
.inner-page .nav a[aria-current="page"]::after { background: var(--accent-deep); }
/* Homepage header once scrolled onto the parchment bar */
.site-header.is-scrolled .nav a[aria-current="page"] { color: var(--accent-deep); }
.site-header.is-scrolled .nav a[aria-current="page"]::after { background: var(--accent-deep); }

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  gap: 6px;
}
.nav-toggle span {
  display: block;
  width: 26px; height: 1.5px;
  background: var(--header-fg);
  transition: transform var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.nav-toggle span:nth-child(2) { width: 20px; }

/* --------------------------------------------------------------------------
   2. BUTTONS + LINKS
   -------------------------------------------------------------------------- */

/* Text + arrow link (the default CTA style) */
.btn-text {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text);
  position: relative;
  padding-block: 0.35rem;
}
.btn-text .arrow {
  transition: transform var(--dur-fast) var(--ease);
}
.btn-text::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--line-strong);
  transform-origin: left;
  transition: transform var(--dur) var(--ease), background-color var(--dur-fast) var(--ease);
}
.btn-text:hover .arrow,
.btn-text:focus-visible .arrow { transform: translateX(4px); }
.btn-text:hover::after,
.btn-text:focus-visible::after { background: var(--accent-deep); }

/* Solid CTA — the single filled moment (used on dark/accent band) */
.btn-solid {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 1.75rem;
  background: var(--champagne);
  color: var(--ebony);
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  border-radius: var(--radius);
  transition: background-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn-solid .arrow { transition: transform var(--dur-fast) var(--ease); }
.btn-solid:hover,
.btn-solid:focus-visible { background: var(--bronze); }
.btn-solid:hover .arrow,
.btn-solid:focus-visible .arrow { transform: translateX(4px); }

/* Magnetic wrapper — JS adds the translate; this is just the safe baseline */
.magnetic { display: inline-block; will-change: transform; }

/* Inline body links */
.link {
  position: relative;
  color: var(--text);
  background-image: linear-gradient(var(--accent-deep), var(--accent-deep));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 1px;
  transition: background-size var(--dur-fast) var(--ease);
  padding-bottom: 1px;
}
.link:hover,
.link:focus-visible { background-size: 100% 1px; }

/* --------------------------------------------------------------------------
   3. SECTION TITLE BLOCK (eyebrow + heading pattern)
   -------------------------------------------------------------------------- */
.section-head { max-width: 52ch; }
.section-head .eyebrow { margin-bottom: var(--sp-4); }

/* Numbered editorial list (services teaser, process) */
.index-list { border-top: 1px solid var(--line); }
.index-row {
  display: grid;
  grid-template-columns: 4rem 1fr auto;
  align-items: baseline;
  gap: var(--sp-4);
  padding-block: clamp(1.5rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  transition: padding-left var(--dur-fast) var(--ease);
}
.index-row .num {
  font-family: var(--font-ui);
  font-weight: 300;
  font-size: var(--fs-small);
  color: var(--text-muted);
  letter-spacing: 0.1em;
}
.index-row .row-title { font-size: var(--fs-h3); }
.index-row .row-desc {
  max-width: 42ch;
  color: var(--text-muted);
  font-size: var(--fs-small);
}
@media (hover: hover) {
  .index-row:hover { padding-left: 0.75rem; }
}

/* --------------------------------------------------------------------------
   4. PORTFOLIO CARD
   -------------------------------------------------------------------------- */
.work-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gutter) var(--gutter);
}
.work-card { display: block; }
.work-card .media {
  aspect-ratio: 4 / 3;
  margin-bottom: var(--sp-3);
}
.work-card .media img {
  transition: transform var(--dur-slow) var(--ease);
}
.work-card__title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: var(--fs-h3);
  line-height: 1.15;
  display: inline-block;
  transition: transform var(--dur-fast) var(--ease);
}
.work-card__rule {
  width: 0; height: 1px;
  background: var(--accent-deep);
  margin-top: 0.5rem;
  transition: width var(--dur) var(--ease);
}
.work-card__meta { margin-top: 0.4rem; }
.work-card__desc {
  margin-top: 0.5rem;
  font-size: var(--fs-small);
  color: var(--text-muted);
  max-width: 38ch;
}
@media (hover: hover) {
  .work-card:hover .media img { transform: scale(1.05); }
  .work-card:hover .work-card__title { transform: translateX(6px); }
  .work-card:hover .work-card__rule { width: 3rem; }
}

/* --------------------------------------------------------------------------
   5. ACCESSIBLE TABS (portfolio module)
   -------------------------------------------------------------------------- */
.tabs__list {
  display: inline-flex;
  gap: var(--sp-5);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--sp-6);
}
.tabs__tab {
  position: relative;
  padding: 0.5rem 0 1rem;
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease);
}
.tabs__tab[aria-selected="true"] { color: var(--text); }
.tabs__tab::after {
  content: "";
  position: absolute;
  left: 0; bottom: -1px;
  width: 100%; height: 1px;
  background: var(--accent-deep);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-fast) var(--ease);
}
.tabs__tab[aria-selected="true"]::after { transform: scaleX(1); }

.tabs__panel { display: none; }
.tabs__panel.is-active { display: block; }
/* Reserve vertical rhythm so switching tabs doesn't shift layout (CLS) */
.tabs__panels { min-height: 1px; }

/* --------------------------------------------------------------------------
   6. CUSTOM CURSOR (optional; JS-driven; pointer + fine only)
   -------------------------------------------------------------------------- */
.cursor-dot {
  position: fixed;
  top: 0; left: 0;
  width: 8px; height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: var(--accent-deep);
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease),
              width var(--dur-fast) var(--ease),
              height var(--dur-fast) var(--ease),
              background-color var(--dur-fast) var(--ease);
  mix-blend-mode: multiply;
}
.cursor-dot.is-active { opacity: 1; }
.cursor-dot.is-hover {
  width: 36px; height: 36px;
  margin: -18px 0 0 -18px;
  background: rgba(166, 137, 84, 0.18);
}

/* --------------------------------------------------------------------------
   7. FOOTER
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--line);
  padding-block: clamp(3rem, 6vw, 5rem) 2rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--sp-6);
  align-items: start;
}
.footer-brand .brand-word {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: 1.6rem;
}
.footer-brand p {
  margin-top: 0.75rem;
  max-width: 32ch;
  color: var(--text-muted);
  font-size: var(--fs-small);
}
.footer-col h4 {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: var(--fs-eyebrow);
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
}
.footer-col ul { display: grid; gap: 0.6rem; }
.footer-col a {
  font-size: var(--fs-small);
  color: var(--text);
  position: relative;
}
.footer-col a:hover { color: var(--accent-deep); }
.footer-bottom {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-bottom small {
  font-size: var(--fs-small);
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

/* --------------------------------------------------------------------------
   8. PAGE-TRANSITION OVERLAY (parchment wipe; JS-driven)
   -------------------------------------------------------------------------- */
.page-veil {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--parchment);
  transform: scaleY(0);
  transform-origin: bottom;
  pointer-events: none;
}

/* Responsive behaviour lives in responsive.css (Phase 5).
   Minimal inline fallback so the foundation page is usable now: */
@media (max-width: 860px) {
  .nav { display: none; }
  .nav-toggle { display: flex; }
  .footer-grid { grid-template-columns: 1fr; gap: var(--sp-5); }
  .work-grid { grid-template-columns: 1fr; }
  .index-row { grid-template-columns: 2.5rem 1fr; }
  .index-row .row-desc { grid-column: 2; }
}

/* ==========================================================================
   FLOATING WHATSAPP BUTTON (global, all pages)
   Ebony pill with champagne icon — expands to reveal label on hover.
   ========================================================================== */
.wa-float {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 150;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  height: 3.5rem;
  padding: 0 1.05rem;
  background: var(--ebony);
  color: var(--ivory);
  border-radius: 100px;
  box-shadow: 0 14px 36px -12px rgba(28, 25, 21, 0.55);
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: var(--fs-small);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  max-width: 3.5rem;                 /* icon-only at rest */
  transition: max-width var(--dur) var(--ease),
              background-color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
  animation: waIn 0.6s var(--ease) both;
  animation-delay: 1s;
}
.wa-float__icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem; height: 1.4rem;
  color: var(--champagne);
  transition: color var(--dur-fast) var(--ease);
}
.wa-float__label {
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
/* Expand on hover / focus / keyboard */
.wa-float:hover,
.wa-float:focus-visible {
  max-width: 16rem;
  background: #423c33;
  transform: translateY(-2px);
  box-shadow: 0 18px 44px -12px rgba(28, 25, 21, 0.6);
}
.wa-float:hover .wa-float__label,
.wa-float:focus-visible .wa-float__label {
  opacity: 1;
  transform: translateX(0);
}
.wa-float:hover .wa-float__icon,
.wa-float:focus-visible .wa-float__icon { color: var(--champagne); }

/* Subtle attention pulse ring */
.wa-float::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 0 rgba(228, 188, 116, 0.5);
  animation: waPulse 3s var(--ease) infinite;
  animation-delay: 2s;
  pointer-events: none;
}

@keyframes waIn {
  from { opacity: 0; transform: translateY(14px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes waPulse {
  0%   { box-shadow: 0 0 0 0 rgba(228, 188, 116, 0.45); }
  70%  { box-shadow: 0 0 0 14px rgba(228, 188, 116, 0); }
  100% { box-shadow: 0 0 0 0 rgba(228, 188, 116, 0); }
}

/* Mobile: keep it icon-only and tidy; lift above any bottom UI */
@media (max-width: 560px) {
  .wa-float { height: 3.25rem; max-width: 3.25rem; padding: 0 0.95rem; }
  /* tap still works; label expands on tap-hold/focus */
}

/* Don't let the pulse/animation run for reduced-motion users */
@media (prefers-reduced-motion: reduce) {
  .wa-float { animation: none; }
  .wa-float::after { animation: none; content: none; }
}

/* When the lightbox is open, hide the floating button so it doesn't overlap */
.no-scroll .wa-float { opacity: 0; pointer-events: none; }
