/* ============================================
   CSS Variables
   ============================================ */
:root {
  /* Color palette */
  --cream: #f4f1e6;
  --ink: #303030;
  --cta: #ff5d2e;

  /* Lighthouse follower sizing/offset */
  --lh-size: 75px;  /* lightbeam size */
  --lh-gap-x: 8px;  /* gap to the right of the 't' */

  /* Grid paper */
  --grid-cell: 18px;                 /* grid cell size */
  --grid-line: rgba(0,0,0,0.08);     /* subtle line color */
}

/* ============================================
   Base Styles
   ============================================ */
body {
  background: var(--cream);
  color: var(--ink);
  font-synthesis-weight: none;
  margin: 0;
  padding: 0;
}

/* ============================================
   Layout - Mobile First
   ============================================ */

/* Main container: mobile stack, desktop side-by-side */
.main-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

/* Desktop: prevent scrolling when content fits */
@media (min-width: 768px) {
  .main-container {
    max-height: 100vh;
    overflow: hidden;
  }
}

/* Content section: mobile full width, desktop fixed width */
.content-section {
  width: 100%;
  position: relative;
  z-index: 2;
  background: var(--cream);
  padding: 2rem 1.5rem;
  /* Prevent shrinking - left side controls the layout */
  flex-shrink: 0;
  /* Allow scrolling on mobile */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Content wrapper: flexbox layout */
.content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: min(90%, 500px);
  width: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Desktop: side-by-side layout - left controls, right adjusts */
@media (min-width: 768px) {
  .main-container {
    flex-direction: row;
    align-items: flex-start; /* Start from top, don't stretch */
    min-height: 100vh;
    max-height: 100vh;
    overflow: hidden;
  }

  .content-section {
    /* Fixed width on desktop - left side controls */
    width: 50%;
    min-width: 50%;
    max-width: 50%;
    padding: 4rem 1rem;
    display: flex;
    align-items: flex-start; /* Start from top */
    flex-shrink: 0; /* Never shrink */
    /* Fit within viewport */
    height: 100vh;
    max-height: 100vh;
    overflow-y: auto; /* Allow scrolling only if content exceeds viewport */
  }

  .content-wrapper {
    width: 100%;
    max-width: min(96%, 600px);
    /* Let content determine height naturally */
    flex: 0 0 auto;
    padding: 0 2rem;
  }
}

/* Hero section: mobile background, desktop side panel */
.hero-section {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  overflow: hidden;
  /* Ensure it fills the space */
  min-height: 100vh;
}

/* Mobile: allow scrolling */
@media (max-width: 767px) {
  .main-container {
    /* Allow natural scrolling on mobile */
    min-height: 100vh;
    overflow: visible;
  }
  
  .content-section {
    /* Allow content to scroll naturally */
    min-height: auto;
    height: auto;
  }
  
  .hero-section {
    /* Background image on mobile, doesn't block scrolling */
    position: fixed;
    z-index: 0;
  }
}

.hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  /* Fill entire space */
  min-width: 100%;
  min-height: 100%;
}

/* Desktop: hero on right side - adjusts to match left side height */
@media (min-width: 768px) {
  .hero-section {
    position: relative;
    /* Take remaining space - adjust to left side */
    flex: 1;
    min-width: 0; /* Allow flexbox to shrink if needed */
    z-index: 1;
    display: flex;
    align-items: flex-start; /* Start from top */
    /* Match viewport height exactly */
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
  }

  .hero-image {
    /* Fill entire right section - match viewport height */
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    flex: 1;
    /* Match viewport height exactly */
    min-height: 100%;
    max-height: 100%;
  }
}

/* ============================================
   Component Styles
   ============================================ */

/* Logo wrap */
.logo-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  /* Ensure lighthouse doesn't overlap incorrectly */
  overflow: visible;
}

.logo-wordmark {
  letter-spacing: 0;
}

/* Launch pill */
.launch-pill {
  width: fit-content;
  height: 30px;
  padding: 0 12px;
  border-radius: 4px;
  background: rgba(255, 93, 46, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0;
}

.launch-pill-text {
  font-family: "Inter", ui-sans-serif, system-ui;
  font-weight: 600;
  font-size: 20px;
  color: #000000;
  line-height: 1;
}

/* Headline card */
.headline-card {
  margin-top: 1rem;
  /* Grid background is applied via .grid-paper class */
  width: 100%;
}

/* Ensure headline rotator wraps properly and doesn't overflow */
#headline-rotator {
  width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  margin: 0;
}

/* Beneath text */
.beneath-text {
  font-family: "Inter", ui-sans-serif, system-ui;
  font-weight: 600;
  font-size: 18px;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: #303030;
  margin-top: 1rem;
}

/* Signup row */
.signup-row {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

@media (min-width: 640px) {
  .signup-row {
    flex-direction: row;
    align-items: center;
    gap: 15px;
  }
}

/* Email input - responsive */
.email-input {
  flex: 1;
  width: 100%;
  min-height: 44px; /* Touch-friendly minimum height */
  background: #D9D9D9;
  border: 0;
  border-radius: 5px;
  padding: 0 16px;
  font-family: "Inter", ui-sans-serif, system-ui;
  font-weight: 400;
  font-size: 16px; /* Prevent zoom on iOS */
  letter-spacing: 0.01em;
  line-height: 1.5;
  color: #303030;
  outline: none;
  transition: background-color 0.2s, box-shadow 0.2s;
  /* Mobile-first responsive sizing */
  height: 44px;
}

/* Focus state */
.email-input:focus {
  background: #FFF;
  box-shadow: 0 0 0 2px rgba(255, 93, 46, 0.2);
}

.email-input::placeholder {
  color: #9D9D9D;
}

/* Desktop: smaller height */
@media (min-width: 640px) {
  .email-input {
    height: 35px;
    min-height: 35px;
    font-size: 14px;
    padding: 0 12px;
  }
}

/* Join button - responsive */
.join-button {
  width: 100%;
  min-height: 44px; /* Touch-friendly minimum height */
  background: #FF5D2E;
  color: #FFFFFF;
  border: 0;
  border-radius: 5px;
  font-family: "Inter", ui-sans-serif, system-ui;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.05em;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  /* Mobile-first responsive sizing */
  height: 44px;
}

.join-button:hover {
  opacity: 0.9;
}

.join-button:active {
  transform: scale(0.98);
}

.join-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* Desktop: smaller fixed width */
@media (min-width: 640px) {
  .join-button {
    width: 95px;
    height: 35px;
    min-height: 35px;
    font-size: 16px;
  }
}

.join-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Honeypot */
.honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
}

/* Signup status */
/* Status message positioned under the form */
.signup-status {
  margin-top: 0.75rem;
  margin-bottom: 0;
  min-height: 1.5rem;
  font-family: "Inter", ui-sans-serif, system-ui;
  font-size: 14px;
  color: #303030;
  display: none; /* Hidden by default, shown when message is set */
}

.signup-status:not(:empty) {
  display: block; /* Show when content is added */
}

/* Avatar row */
.avatar-row {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
  margin-top: 1.5rem;
}

@media (min-width: 640px) {
  .avatar-row {
    flex-direction: row;
    align-items: center;
    gap: 15px;
  }
}

.avatar-group {
  display: flex;
  gap: -12px;
  min-width: 120px;
}

.avatar-group .avatar {
  margin-left: -12px;
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

.avatar-text {
  font-family: "Inter", ui-sans-serif, system-ui;
  font-weight: 400;
  font-size: 14px;
  letter-spacing: 0.01em;
  color: #000000;
  margin: 0;
}

.avatar-link {
  font-weight: 600;
  text-decoration: none;
  color: #000000;
}

.avatar-link:hover {
  text-decoration: underline;
}

/* Site footer */
.site-footer {
  margin-top: 3rem;
  font-family: "Inter", ui-sans-serif, system-ui;
  font-weight: 400;
  font-size: 14px;
  color: #666;
}

.footer-bold {
  font-weight: 700;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.hidden {
  display: none;
}

/* ============================================
   Logo Wordmark
   ============================================ */
#logo-wordmark {
  font-family: "Inter", ui-sans-serif, system-ui;
  font-weight: 700;
  font-size: 48px;
  letter-spacing: 0;
  color: #000000;
  display: flex;
  align-items: baseline;
  gap: 0;
  font-kerning: normal;
  line-height: 1;
  padding-top: 2px;
  padding-bottom: 2px;
}

#logo-wordmark .l {
  display: inline-block;
  overflow: hidden;
  vertical-align: baseline;
  white-space: nowrap;
}

/* Start hidden/cream so it reads visually as "hdhnt" until reveal */
#logo-wordmark .e,
#logo-wordmark .a,
#logo-wordmark .u {
  width: 0;
  color: #f4f1e6;
}

/* Static segments already in final color */
#logo-wordmark .h1,
#logo-wordmark .d,
#logo-wordmark .h2,
#logo-wordmark .n,
#logo-wordmark .t {
  color: #303030;
}

/* ============================================
   Headline Rotator
   ============================================ */
#headline-rotator {
  font-family: "Noto Sans Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-weight: 550;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
  color: #303030;
  word-break: keep-all;
  overflow-wrap: normal;
  /* Ensure words don't break */
  white-space: normal;
  hyphens: none;
}

/* Mobile size */
@media (min-width: 768px) {
  #headline-rotator {
    font-size: 26px;
  }
}

/* Desktop size */
@media (min-width: 1140px) {
  #headline-rotator {
    font-size: 32px;
  }
}

/* ============================================
   Grid Paper Card
   ============================================ */
.grid-paper {
  position: relative;
  background-color: #f4f1e6;
  border-radius: 4px;
  padding: 24px;
  max-width: 500px;
  overflow: hidden;
  /* Prevent layout shift - accommodate up to 4 lines of text */
  /* Mobile: 22px font * 1.2 line-height * 4 lines = ~106px + 48px padding = ~154px */
  min-height: 180px;
  /* Ensure content doesn't cause overflow */
  display: flex;
  align-items: center;
}

/* Desktop: larger font size, adjust min-height for 4 lines */
@media (min-width: 768px) {
  .grid-paper {
    /* Desktop: 32px font * 1.2 line-height * 4 lines = ~154px + 48px padding = ~202px */
    min-height: 240px; /* Accommodate 4 lines with some buffer */
  }
}

@media (min-width: 1140px) {
  .grid-paper {
    min-height: 210px; /* Accommodate 4 lines with some buffer */
  }
}

/* Draw the grid on a larger, offset layer so edges are cut mid-line */
.grid-paper::before {
  content: "";
  position: absolute;
  top: calc(var(--grid-cell) * -0.8);
  left: calc(var(--grid-cell) * -0.8);
  right: calc(var(--grid-cell) * -0.0);
  bottom: calc(var(--grid-cell) * -0.8);
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-cell) var(--grid-cell);
  background-position: calc(var(--grid-cell) * -0.5) calc(var(--grid-cell) * -0.5);
  pointer-events: none;
}

/* Ensure headline sits above the grid layer */
.grid-paper > * {
  position: relative;
  z-index: 1;
}

/* ============================================
   Avatar Styles
   ============================================ */
.avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid #f4f1e6;
  object-fit: cover;
}

/* ============================================
   Animations
   ============================================ */

/* Lighthouse follower: animated SVG pulse */
#lighthouse-follow {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--lh-size);
  height: var(--lh-size);
  display: block;
  z-index: 10; /* Above the logo text but not too high */
  will-change: transform;
  transform: translateZ(0); /* Force GPU acceleration */
  pointer-events: none;
  overflow: visible; /* Allow circles to scale beyond container */
}

#lighthouse-follow svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible; /* Allow circles to scale beyond viewBox */
  filter:
    drop-shadow(0 0 1px rgba(255,115,80,.35))
    drop-shadow(0 0 8px rgba(255,115,80,.35));
}

/* Base opacity for circles - matches SVG values */
#lighthouse-follow .pulse-circle-1,
#lighthouse-follow .pulse-circle-2,
#lighthouse-follow .pulse-circle-3,
#lighthouse-follow .pulse-circle-4,
#lighthouse-follow .pulse-circle-5,
#lighthouse-follow .pulse-circle-6 {
  opacity: 0.1; /* Outer 6 circles: 10% opacity */
}

#lighthouse-follow .pulse-circle-7,
#lighthouse-follow .pulse-circle-8,
#lighthouse-follow .pulse-circle-9,
#lighthouse-follow .pulse-circle-10 {
  opacity: 1; /* Inner 4 circles: full opacity */
}

/* Pulse animation - always playing */
#lighthouse-follow .pulse-circle-1 {
  animation: pulseCircle1 2s ease-in-out infinite;
}

#lighthouse-follow .pulse-circle-2 {
  animation: pulseCircle2 2s ease-in-out infinite 0.1s;
}

#lighthouse-follow .pulse-circle-3 {
  animation: pulseCircle3 2s ease-in-out infinite 0.2s;
}

#lighthouse-follow .pulse-circle-4 {
  animation: pulseCircle4 2s ease-in-out infinite 0.3s;
}

#lighthouse-follow .pulse-circle-5 {
  animation: pulseCircle5 2s ease-in-out infinite 0.4s;
}

#lighthouse-follow .pulse-circle-6 {
  animation: pulseCircle6 2s ease-in-out infinite 0.5s;
}

#lighthouse-follow .pulse-circle-7 {
  animation: pulseCircle7 2s ease-in-out infinite 0.6s;
}

#lighthouse-follow .pulse-circle-8 {
  animation: pulseCircle8 2s ease-in-out infinite 0.7s;
}

#lighthouse-follow .pulse-circle-9 {
  animation: pulseCircle9 2s ease-in-out infinite 0.8s;
}

#lighthouse-follow .pulse-circle-10 {
  animation: pulseCircle10 2s ease-in-out infinite 0.9s;
}

/* Keyframe animations for each circle - animate scale and slight opacity pulse */
/* Outer 6 circles: animate from base 0.1 to slightly brighter and back */
@keyframes pulseCircle1 {
  0%, 100% { 
    opacity: 0.1; 
    transform: scale(1);
  }
  50% { 
    opacity: 0.15; 
    transform: scale(1.067); /* 40/37.5 */
  }
}

@keyframes pulseCircle2 {
  0%, 100% { 
    opacity: 0.1; 
    transform: scale(1);
  }
  50% { 
    opacity: 0.15; 
    transform: scale(1.074); /* 36.25/33.75 */
  }
}

@keyframes pulseCircle3 {
  0%, 100% { 
    opacity: 0.1; 
    transform: scale(1);
  }
  50% { 
    opacity: 0.15; 
    transform: scale(1.083); /* 32.5/30 */
  }
}

@keyframes pulseCircle4 {
  0%, 100% { 
    opacity: 0.1; 
    transform: scale(1);
  }
  50% { 
    opacity: 0.15; 
    transform: scale(1.095); /* 28.75/26.25 */
  }
}

@keyframes pulseCircle5 {
  0%, 100% { 
    opacity: 0.1; 
    transform: scale(1);
  }
  50% { 
    opacity: 0.15; 
    transform: scale(1.111); /* 25/22.5 */
  }
}

@keyframes pulseCircle6 {
  0%, 100% { 
    opacity: 0.1; 
    transform: scale(1);
  }
  50% { 
    opacity: 0.15; 
    transform: scale(1.133); /* 21.25/18.75 */
  }
}

/* Inner 4 circles: animate scale only, keep opacity at 1.0 */
@keyframes pulseCircle7 {
  0%, 100% { 
    opacity: 1; 
    transform: scale(1);
  }
  50% { 
    opacity: 1; 
    transform: scale(1.167); /* 17.5/15 */
  }
}

@keyframes pulseCircle8 {
  0%, 100% { 
    opacity: 1; 
    transform: scale(1);
  }
  50% { 
    opacity: 1; 
    transform: scale(1.222); /* 13.75/11.25 */
  }
}

@keyframes pulseCircle9 {
  0%, 100% { 
    opacity: 1; 
    transform: scale(1);
  }
  50% { 
    opacity: 1; 
    transform: scale(1.333); /* 10/7.5 */
  }
}

@keyframes pulseCircle10 {
  0%, 100% { 
    opacity: 1; 
    transform: scale(1);
  }
  50% { 
    opacity: 1; 
    transform: scale(1.667); /* 6.25/3.75 */
  }
}

@media (prefers-reduced-motion: reduce) {
  #lighthouse-follow {
    display: none;
  }
}

/* Smooth text scrambler animation */
.text-scramble-char {
  display: inline-block;
  will-change: contents;
}

/* Word containers to prevent breaking within words */
.scramble-word {
  display: inline-block !important;
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
  hyphens: none !important;
  /* Prevent any line breaks */
  page-break-inside: avoid;
  break-inside: avoid;
  /* Ensure word container itself doesn't break */
  box-decoration-break: clone;
}

/* Character spans inside words - must be inline, not inline-block */
.scramble-word .char-span {
  display: inline !important;
  white-space: nowrap !important;
  /* Prevent individual characters from breaking */
  word-break: keep-all !important;
}

/* Spaces outside word containers - prevent breaking before them */
.char-span[data-is-space="true"] {
  display: inline !important;
  white-space: nowrap !important;
  /* Prevent space from appearing at start of new line */
  word-break: keep-all !important;
}

/* Ensure spaces are attached to the next word container */
.scramble-word + .char-span[data-is-space="true"],
.char-span[data-is-space="true"] + .scramble-word {
  /* Ensure space and word stay together */
  white-space: nowrap;
}

/* Default for character spans */
.char-span {
  display: inline !important;
  white-space: nowrap !important;
}

