/* ---------------------------------------------------------------------------
 * Nest4Ideas marketing site.
 *
 * The tokens below mirror the app (frontend/src/assets/main.css) one for one,
 * so the site and the product read as the same brand. The brand is gold
 * (#c9a15c). It cannot be the light-theme primary: on white it is 2.4:1, well
 * under the 4.5:1 AA floor, so light mode uses a deeper shade of the same hue
 * and keeps the gold for decoration only. Dark mode uses the gold itself.
 * ------------------------------------------------------------------------- */

/* Inter Variable, self-hosted. No third-party request is made to render the
   page, which keeps the site out of the Google Fonts GDPR discussion. */
@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/inter-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/inter-latin-wght-normal.woff2') format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}

/* --------------------------------- tokens -------------------------------- */

:root {
  color-scheme: light;

  /* Brand gold. Decorative in light mode, primary in dark mode. */
  --gold: #c9a15c;

  --background: #f4f4f7;
  --foreground: #23232a;
  --card: #ffffff;
  --card-foreground: #23232a;
  --primary: #7a5c26;
  --primary-foreground: #ffffff;
  --primary-hover: #5f4720;
  --secondary: #f7f1e4;
  --secondary-foreground: #6a4f20;
  --muted-foreground: #6b6b76;
  --border: rgba(0, 0, 0, 0.09);
  --border-strong: rgba(0, 0, 0, 0.16);
  --ring: rgba(122, 92, 38, 0.4);

  /* Inverted surface used by the closing call to action. */
  --deep: #23232a;
  --deep-elevated: #2c2c34;
  --deep-foreground: #f3f3f5;
  --deep-muted: #a0a0ab;
  --deep-accent: #c9a15c;
  --deep-border: rgba(255, 255, 255, 0.12);

  /* Semantic accents, shared by both themes. Warning shares a family with the
     brand gold, so it leans orange to stay distinguishable. */
  --info: #2f7fd4;
  --success: #2f8f4e;
  --warning: #c4620f;
  --danger: #d24a45;

  --shadow-sm:
    0 1px 2px rgba(23, 23, 27, 0.06), 0 1px 3px rgba(23, 23, 27, 0.05);
  --shadow-md: 0 12px 32px -14px rgba(23, 23, 27, 0.24);

  --radius-card: 12px;
  --radius-badge: 20px;
  --radius-input: 8px;

  --container: 1120px;
  --nav-h: 68px;
}

html.dark {
  color-scheme: dark;

  --background: #17171b;
  --foreground: #f3f3f5;
  --card: #212127;
  --card-foreground: #f3f3f5;
  --primary: #c9a15c;
  --primary-foreground: #2a1f0b;
  --primary-hover: #dcbb80;
  --secondary: #3a2d13;
  --secondary-foreground: #dcbb80;
  --muted-foreground: #a0a0ab;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.16);
  --ring: rgba(201, 161, 92, 0.45);

  --deep: #212127;
  --deep-elevated: #2a2a31;
  --deep-foreground: #f3f3f5;
  --deep-muted: #a0a0ab;
  --deep-accent: #c9a15c;
  --deep-border: rgba(255, 255, 255, 0.1);

  --danger: #f07a75;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 14px 36px -16px rgba(0, 0, 0, 0.7);
}

/* ---------------------------------- base --------------------------------- */

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

* {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--background);
  color: var(--foreground);
  font-family: 'Inter Variable', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

h1,
h2,
h3 {
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-wrap: balance;
}

/* Balancing a heading inside a phone-width column strands single words on a
   line of their own, so fall back to plain wrapping with orphan avoidance. */
@media (max-width: 640px) {
  h1,
  h2,
  h3 {
    text-wrap: pretty;
  }
}

:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
  border-radius: 4px;
}

/* The closing panel keeps its dark surface in both themes, so the ring has to
   be the gold rather than the light-theme primary to stay visible on it. */
.cta :focus-visible {
  outline-color: var(--deep-accent);
}

.skip-link:focus-visible {
  outline-offset: -3px;
}

/* The open navigation panel covers the page; stop the page scrolling under it. */
body.nav-open {
  overflow: hidden;
}

/* ------------------------------ language hint ----------------------------- */

.lang-hint {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.lang-hint[hidden] {
  display: none;
}

.lang-hint-inner {
  display: flex;
  align-items: center;
  gap: 8px 16px;
  flex-wrap: wrap;
  padding-block: 10px;
}

.lang-hint-text {
  margin-inline-end: auto;
}

.lang-hint-go {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.lang-hint-go:hover {
  color: var(--primary);
}

.lang-hint-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: inherit;
  opacity: 0.7;
}

.lang-hint-close:hover {
  opacity: 1;
}

.lang-hint-close .icon {
  width: 16px;
  height: 16px;
}

.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;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 12px 18px;
  border-radius: 0 0 var(--radius-input) 0;
  font-size: 0.9rem;
  font-weight: 500;
}

.skip-link:focus {
  left: 0;
}

/* -------------------------------- layout --------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(20px, 4vw, 32px);
}

.eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.section-head {
  margin-bottom: clamp(28px, 4vw, 40px);
}

.section-head h2 {
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  margin-top: 10px;
}

.lede {
  color: var(--muted-foreground);
  font-size: 1.05rem;
  max-width: 56ch;
}

/* -------------------------------- buttons -------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 12px 22px;
  border-radius: var(--radius-input);
  border: 1px solid transparent;
  transition:
    background-color 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-ghost {
  border-color: var(--border-strong);
  color: var(--foreground);
}

.btn-ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-input);
  border: 1px solid transparent;
  color: var(--muted-foreground);
  transition:
    background-color 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease;
}

.icon-btn:hover {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border-color: var(--border);
}

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* -------------------------------- header --------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--background) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: var(--nav-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.brand img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 30px;
  margin-inline-start: auto;
}

.site-nav a {
  font-size: 0.92rem;
  color: var(--muted-foreground);
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition:
    color 0.18s ease,
    border-color 0.18s ease;
}

.site-nav a:hover,
.site-nav a[aria-current='true'] {
  color: var(--foreground);
  border-bottom-color: var(--primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-actions .btn {
  padding: 10px 18px;
  font-size: 0.88rem;
}

.nav-toggle {
  display: none;
}

/* Language switch. Two real links, so it works with scripting disabled and
   needs no menu semantics for a choice of two. */
.lang {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 2px;
  margin-inline-end: 2px;
}

.lang-opt {
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
  transition:
    background-color 0.18s ease,
    color 0.18s ease;
}

.lang-opt:hover {
  color: var(--foreground);
}

.lang-opt[aria-current='page'] {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.theme-toggle .icon-moon {
  display: none;
}

html.dark .theme-toggle .icon-sun {
  display: none;
}

html.dark .theme-toggle .icon-moon {
  display: block;
}

.nav-toggle .icon-close {
  display: none;
}

.nav-toggle[aria-expanded='true'] .icon-menu {
  display: none;
}

.nav-toggle[aria-expanded='true'] .icon-close {
  display: block;
}

@media (max-width: 860px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    padding: 8px clamp(20px, 4vw, 32px) 20px;
  }

  .site-nav[hidden] {
    display: none;
  }

  .site-nav a {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    font-size: 1rem;
  }

  .site-nav a:hover,
  .site-nav a[aria-current='true'] {
    border-bottom-color: var(--border);
  }
}

/* The header CTA survives on tablets; only the narrowest phones lose it. */
@media (max-width: 540px) {
  .header-actions .btn-cta {
    display: none;
  }
}

/* A finger is not a mouse pointer: controls grow to the 44px platform minimum
   on touch input without loosening desktop density. */
@media (pointer: coarse) {
  .icon-btn {
    width: 44px;
    height: 44px;
  }

  .lang-opt {
    padding: 9px 11px;
  }
}

/* --------------------------------- hero ---------------------------------- */

.hero {
  padding: clamp(48px, 9vw, 88px) 0 clamp(48px, 7vw, 64px);
}

.hero h1 {
  font-size: clamp(2rem, 5.2vw, 3.4rem);
  margin: 18px 0 22px;
  max-width: 16ch;
}

.hero .lede {
  margin-bottom: 34px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: clamp(36px, 6vw, 52px);
}

/* Below this the pair no longer fits on one row, so let each button fill it
   rather than stack at its intrinsic width. */
@media (max-width: 400px) {
  .hero-actions .btn {
    flex: 1 1 100%;
  }

  /* The mark alone carries the brand; the link keeps its accessible name. */
  .brand-name {
    display: none;
  }
}

/* The signature ledger rule: a line that draws itself in brand gold. */
.ledger-rule {
  position: relative;
  height: 1px;
  width: 100%;
  background: var(--border-strong);
  overflow: hidden;
}

.ledger-rule::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  animation: draw 1.4s cubic-bezier(0.65, 0, 0.35, 1) 0.3s forwards;
}

@keyframes draw {
  to {
    transform: scaleX(1);
  }
}

.hero-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 20px 24px;
  padding: 28px 0 0;
}

.hero-facts div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-facts dt {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.hero-facts dd {
  font-size: 0.98rem;
  font-weight: 500;
}

/* ------------------------------ ledger rows ------------------------------ */

.ledger-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) minmax(0, 2fr);
  gap: 28px;
  align-items: baseline;
  padding: 26px 0;
  border-top: 1px solid var(--border);
}

.ledger-list .ledger-row:last-child {
  border-bottom: 1px solid var(--border);
}

.ledger-num {
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  color: var(--primary);
}

.ledger-row h3 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.ledger-row p {
  color: var(--muted-foreground);
  font-size: 0.97rem;
  max-width: 52ch;
}

@media (max-width: 760px) {
  .ledger-row {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 8px 16px;
  }

  .ledger-row p {
    grid-column: 2;
  }
}

/* -------------------------------- sections ------------------------------- */

.section {
  padding: clamp(44px, 7vw, 72px) 0 clamp(52px, 8.5vw, 88px);
  border-top: 1px solid var(--border);
}

.section-plain {
  padding: clamp(36px, 5.5vw, 56px) 0 clamp(44px, 7vw, 72px);
}

.about-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: clamp(32px, 5vw, 64px);
  align-items: start;
}

.about-grid h2 {
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  margin: 10px 0 20px;
}

.about-grid p {
  color: var(--muted-foreground);
  margin-bottom: 16px;
  font-size: 1rem;
  max-width: 60ch;
}

@media (max-width: 860px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  padding: clamp(22px, 4vw, 28px);
}

.card h3 {
  font-size: 1.15rem;
  margin: 6px 0 20px;
}

.card dl {
  font-size: 0.88rem;
}

.card dt {
  color: var(--muted-foreground);
  margin-top: 18px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.card dt:first-of-type {
  margin-top: 0;
}

.card dd {
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--secondary);
  color: var(--secondary-foreground);
  border-radius: var(--radius-badge);
  padding: 5px 13px;
  font-size: 0.78rem;
  font-weight: 500;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

/* ---------------------------------- cta ---------------------------------- */

.cta {
  background: var(--deep);
  color: var(--deep-foreground);
  padding: clamp(56px, 8vw, 84px) 0;
}

.cta-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: clamp(28px, 4vw, 48px);
  align-items: end;
}

.cta .eyebrow {
  color: var(--deep-accent);
}

.cta h2 {
  color: var(--deep-foreground);
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  max-width: 22ch;
  margin: 10px 0 26px;
}

.cta .btn-primary {
  background: var(--deep-accent);
  color: #2a1f0b;
}

.cta .btn-primary:hover {
  background: #dcbb80;
}

.cta-contact {
  font-size: 0.94rem;
  font-style: normal;
  color: var(--deep-muted);
  line-height: 2;
}

.cta-contact a:hover {
  color: var(--deep-accent);
}

.cta-contact strong {
  color: var(--deep-foreground);
  font-weight: 500;
}

@media (max-width: 860px) {
  .cta-grid {
    grid-template-columns: 1fr;
    align-items: start;
  }
}

/* -------------------------------- footer --------------------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 26px 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  font-size: 0.8rem;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}

.footer-inner a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.footer-inner a:hover,
.footer-inner a:focus-visible {
  color: var(--foreground);
}

/* ------------------------------- motion ---------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
}

.reveal.in {
  opacity: 1;
  transform: none;
}

/* Without scripting nothing can toggle `.in`, so opt out of the effect. */
html.no-js .reveal {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .ledger-rule::after {
    animation: none;
    transform: scaleX(1);
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .btn:hover {
    transform: none;
  }
}

/* Hairline borders and muted text are the first things to disappear when a
   reader asks the OS for more contrast. */
@media (prefers-contrast: more) {
  :root {
    --muted-foreground: #4a4a55;
    --border: rgba(0, 0, 0, 0.3);
    --border-strong: rgba(0, 0, 0, 0.45);
  }

  html.dark {
    --muted-foreground: #d0d0d8;
    --border: rgba(255, 255, 255, 0.32);
    --border-strong: rgba(255, 255, 255, 0.5);
    --deep-muted: #d0d0d8;
  }

  .btn,
  .icon-btn,
  .badge,
  .lang {
    border-color: currentColor;
  }
}
