/* ==========================================================================
   Faux King Studio Solutions -- Global Stylesheet
   ==========================================================================
   This file holds SITEWIDE styles: design tokens, reset, base typography,
   layout utilities, and shared components (header/nav, buttons, footer).
   It also contains the styles for this page's own sections (hero, features,
   contact), grouped clearly below.

   Adding a new page later:
   1. Keep every shared rule (tokens, reset, nav, buttons, footer, .container)
      right here in main.css and link it in every page's <head>.
   2. For styles unique to a new page, create a new file, e.g. styles/about.css,
      and link it AFTER main.css on that page only:
        <link rel="stylesheet" href="styles/main.css">
        <link rel="stylesheet" href="styles/about.css">
   This keeps shared styles in one place while letting each page grow its
   own section without bloating main.css.
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  /* Brand colors, drawn from the Faux King crown mark */
  --color-navy-900: #0f2438;
  --color-navy-700: #17334f;
  --color-navy-500: #1f4e79;
  --color-teal-500: #2fc9c1;
  --color-teal-400: #52dcd3;
  --color-teal-300: #8ee9e2;

  --color-bg: #ffffff;
  --color-bg-alt: #f4f8f9;
  --color-surface: #ffffff;
  --color-text: #14213d;
  --color-text-muted: #566274;
  --color-border: #e3e9ec;

  --color-accent: var(--color-teal-500);
  --color-accent-strong: var(--color-navy-500);

  --gradient-brand: linear-gradient(135deg, var(--color-navy-700), var(--color-teal-500));

  --font-heading: 'Poppins', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --container-width: 1120px;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;

  --shadow-sm: 0 2px 8px rgba(15, 36, 56, 0.06);
  --shadow-md: 0 12px 32px rgba(15, 36, 56, 0.12);

  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0b1622;
    --color-bg-alt: #101f30;
    --color-surface: #14263a;
    --color-text: #eef4f6;
    --color-text-muted: #a9b8c4;
    --color-border: #223649;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.45);
  }
}


/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

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

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  line-height: 1.2;
  margin: 0 0 0.5em;
}

p {
  margin: 0 0 1em;
}

button, input, textarea {
  font: inherit;
  color: inherit;
}

/* Respect users who've asked for less motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* --------------------------------------------------------------------------
   3. Layout utilities
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin-inline: auto;
  padding-inline: 1.5rem;
}


/* --------------------------------------------------------------------------
   4. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-block;
  padding: 0.85rem 1.75rem;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-primary {
  background: var(--gradient-brand);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}


/* --------------------------------------------------------------------------
   5. Site header & nav
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 0.75rem;
}

.brand-logo {
  height: 80px;
  width: auto;
}

.primary-nav ul {
  display: flex;
  gap: 2rem;
}

.primary-nav a {
  font-weight: 500;
  font-size: 0.95rem;
  transition: color var(--transition-fast);
}

.primary-nav a:hover,
.primary-nav a:focus-visible {
  color: var(--color-accent-strong);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background-color: var(--color-text);
  border-radius: 2px;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}


/* --------------------------------------------------------------------------
   6. Hero section
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: 6rem 5rem;
  background-color: var(--color-bg-alt);
}

.hero-watermark {
  position: absolute;
  top: 50%;
  right: 5%;
  transform: translateY(-50%);
  width: min(38vw, 420px);
  aspect-ratio: 1.5 / 1;
  background-image: url('../assets/jester/jester-light.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.08;
  pointer-events: none;
}

@media (prefers-color-scheme: dark) {
  .hero-watermark {
    background-image: url('../assets/jester/jester-dark.png');
    opacity: 0.1;
  }
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 640px;
}

.eyebrow {
  display: inline-block;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent-strong);
  background-color: color-mix(in srgb, var(--color-teal-500) 15%, transparent);
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  margin-bottom: 1.25rem;
}

.hero h1 {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 700;
}

.hero-subtext {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  max-width: 52ch;
}


/* --------------------------------------------------------------------------
   7. Features section
   -------------------------------------------------------------------------- */
.features {
  padding-block: 5rem;
}

.features h2 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
}

.section-lede {
  color: var(--color-text-muted);
  margin-bottom: 2.5rem;
  max-width: 60ch;
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1.5rem;
}

.icon-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.5rem 1rem;
  cursor: pointer;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.icon-tile:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.icon-tile:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.icon-tile-visual {
  display: block;
  width: 96px;
  height: 96px;
}

.icon-tile-visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.icon-tile.is-shaking .icon-tile-visual {
  animation: iconShake 0.5s ease;
}

@keyframes iconShake {
  10%, 90% { transform: translate3d(-1px, 0, 0) rotate(-1deg); }
  20%, 80% { transform: translate3d(2px, 0, 0) rotate(2deg); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0) rotate(-3deg); }
  40%, 60% { transform: translate3d(4px, 0, 0) rotate(3deg); }
}

.icon-tile-note {
  display: block;
  min-height: 1.1em;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-accent-strong);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.icon-tile-note.is-visible {
  opacity: 1;
}


/* --------------------------------------------------------------------------
   8. Contact section
   -------------------------------------------------------------------------- */
.contact {
  padding-block: 5rem;
  background-color: var(--color-bg-alt);
}

.contact-inner {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 3rem;
  align-items: start;
}

.contact-copy h2 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
}

.contact-copy p {
  color: var(--color-text-muted);
  max-width: 40ch;
}

.contact-form {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

.form-row {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-row label {
  font-weight: 600;
  font-size: 0.9rem;
}

.form-row .optional {
  font-weight: 400;
  color: var(--color-text-muted);
}

.form-row input,
.form-row textarea {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: var(--color-bg);
  color: var(--color-text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-row input:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-teal-500) 25%, transparent);
}

.form-row input:invalid[data-touched="true"],
.form-row textarea:invalid[data-touched="true"] {
  border-color: #d9534f;
}

.form-note {
  margin: 1rem 0 0;
  font-size: 0.9rem;
  min-height: 1.2em;
}

.form-note[data-state="success"] {
  color: #1f9d55;
}

.form-note[data-state="error"] {
  color: #d9534f;
}


/* --------------------------------------------------------------------------
   9. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  padding-block: 2.5rem;
  border-top: 1px solid var(--color-border);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  text-align: center;
}

.footer-mark {
  height: 30px;
  width: auto;
  opacity: 0.7;
}

.footer-inner p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}


/* --------------------------------------------------------------------------
   10. Responsive breakpoints
   -------------------------------------------------------------------------- */
@media (max-width: 860px) {
  .contact-inner {
    grid-template-columns: 1fr;
  }
}

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

  .primary-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    overflow: hidden;
    max-height: 0;
    transition: max-height var(--transition-base);
  }

  .primary-nav.is-open {
    max-height: 320px;
  }

  .primary-nav ul {
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 1.5rem 1rem;
  }

  .primary-nav li {
    padding-block: 0.6rem;
    border-bottom: 1px solid var(--color-border);
  }

  .primary-nav li:last-child {
    border-bottom: none;
  }

  .hero {
    padding-block: 4rem 3rem;
    text-align: left;
  }

  .hero-watermark {
    width: 60vw;
    opacity: 0.06;
  }
}

@media (max-width: 480px) {
  .contact-form {
    padding: 1.25rem;
  }
}
