/* ============================================================
   feathermode — Landing Page Styles
   ============================================================ */

/* ---- Root: Typography defaults ---- */
:root {
  --display: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  --body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display-weight: 500;
}

/* ---- Palettes ---- */
[data-palette="daylight"] {
  --bg: #F1E6D0;
  --bg-deep: #E8D9BB;
  --ink: #1E1A14;
  --ink-soft: #4A3F30;
  --ink-faint: #8A7A5E;
  --rule: #C9B58F;
  --accent: #8B3A1F;
  --glow: rgba(139, 58, 31, 0.06);
  --grain-opacity: 0.55;
  --vignette: radial-gradient(ellipse at 50% 40%, transparent 40%, rgba(60, 40, 10, 0.18) 100%);
  --field-bg: rgba(255, 255, 255, 0.35);
  --field-border: rgba(30, 26, 20, 0.25);
}

[data-palette="dusk"] {
  --bg: #D8C39E;
  --bg-deep: #BFA77F;
  --ink: #2A1F12;
  --ink-soft: #5A4628;
  --ink-faint: #8A6E48;
  --rule: #9C7F54;
  --accent: #A84418;
  --glow: rgba(168, 68, 24, 0.08);
  --grain-opacity: 0.75;
  --vignette: radial-gradient(ellipse at 50% 45%, transparent 30%, rgba(40, 20, 0, 0.35) 100%);
  --field-bg: rgba(255, 245, 220, 0.25);
  --field-border: rgba(40, 30, 15, 0.3);
}

[data-palette="candlelight"] {
  --bg: #221B0F;
  --bg-deep: #0A0805;
  --ink: #EBC88F;
  --ink-soft: #C09868;
  --ink-faint: #7A6142;
  --rule: #4A3826;
  --accent: #F2A83A;
  --glow: rgba(242, 168, 58, 0.15);
  --grain-opacity: 0.35;
  --vignette: radial-gradient(ellipse at 50% 42%, rgba(242, 168, 58, 0.08) 0%, transparent 45%, rgba(0, 0, 0, 0.75) 100%);
  --field-bg: rgba(235, 200, 143, 0.06);
  --field-border: rgba(235, 200, 143, 0.3);
}

/* ---- Type pairs ---- */
[data-typepair="editorial"] {
  --display: "Cormorant Garamond", Georgia, serif;
  --body: "Inter", sans-serif;
  --display-weight: 500;
}

[data-typepair="garamond"] {
  --display: "EB Garamond", Georgia, serif;
  --body: "Work Sans", sans-serif;
  --display-weight: 500;
}

[data-typepair="quiet"] {
  --display: "Lora", Georgia, serif;
  --body: "IBM Plex Sans", sans-serif;
  --display-weight: 500;
}

/* ---- Base ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
}

body {
  height: 100vh;
  height: 100dvh; /* accounts for mobile browser chrome */
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.55;
  cursor: crosshair;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background 800ms ease, color 800ms ease;
}

/* ---- Ambient layers ---- */

/* Paper grain via layered gradients + vignette */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    var(--vignette),
    radial-gradient(1px 1px at 20% 30%, rgba(0, 0, 0, 0.12) 50%, transparent 51%),
    radial-gradient(1px 1px at 70% 60%, rgba(0, 0, 0, 0.08) 50%, transparent 51%),
    radial-gradient(1px 1px at 40% 80%, rgba(0, 0, 0, 0.10) 50%, transparent 51%);
  opacity: var(--grain-opacity);
  mix-blend-mode: multiply;
  transition: opacity 800ms ease;
}

[data-palette="candlelight"] .grain {
  mix-blend-mode: screen;
}

/* SVG fractal noise for paper fiber texture */
.fiber {
  position: fixed;
  inset: -10%;
  pointer-events: none;
  z-index: 2;
  opacity: 0.35;
  mix-blend-mode: multiply;
}

[data-palette="candlelight"] .fiber {
  opacity: 0.25;
  mix-blend-mode: overlay;
}

/* Warm glow that breathes in candlelight mode */
.flame {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background: radial-gradient(ellipse 60% 50% at 50% 45%, rgba(242, 168, 58, 0.12), transparent 60%);
  opacity: 0;
  transition: opacity 1200ms ease;
}

[data-palette="candlelight"] .flame {
  opacity: 1;
  animation: flicker 5.5s ease-in-out infinite;
}

/* Slow-moving soft ink washes */
.drift {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.55;
}

.drift svg {
  width: 100%;
  height: 100%;
}

/* ---- Stage (page grid) ---- */
.stage {
  position: relative;
  z-index: 10;
  height: 100%;          /* fills the 100dvh body exactly */
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(24px, 4vw, 56px) clamp(24px, 5vw, 72px);
}

/* ---- Header ---- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--body);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  opacity: 0;
  animation: fadeIn 1200ms ease 200ms forwards;
}

.top .mark {
  font-family: var(--display);
  font-style: italic;
  font-size: 18px;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--ink-soft);
}

.top .meta {
  font-variant-numeric: tabular-nums;
}

/* ---- Hero ---- */
.hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: clamp(20px, 3vh, 40px);
  padding: 4vh 0;
  overflow-y: auto;
  scrollbar-width: none;   /* Firefox */
}

.hero::-webkit-scrollbar {
  display: none;           /* Chrome/Safari */
}

.hero .eyebrow {
  font-family: var(--body);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-faint);
  opacity: 0;
  animation: fadeIn 1200ms ease 400ms forwards;
}

.hero .wordmark {
  font-family: var(--display);
  font-weight: var(--display-weight);
  font-size: clamp(56px, 10vw, 136px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: var(--ink);
  opacity: 0;
  animation: inkBleed 1600ms ease 700ms forwards;
}

.hero .tagline {
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(22px, 3.2vw, 36px);
  line-height: 1.25;
  letter-spacing: -0.005em;
  color: var(--ink-soft);
  max-width: 22ch;
  text-wrap: balance;
  opacity: 0;
  animation: fadeIn 1400ms ease 1400ms forwards;
  position: relative;
}

/* Blinking cursor after tagline */
.cursor {
  display: inline-block;
  width: 0.08em;
  height: 0.95em;
  background: var(--ink);
  vertical-align: -0.12em;
  margin-left: 0.12em;
  animation: breathe 2.8s ease-in-out infinite;
}

/* Vertical decorative rule */
.rule {
  width: 1px;
  height: 64px;
  background: var(--rule);
  margin: 0 auto;
  opacity: 0;
  animation: growRule 1200ms ease 2100ms forwards;
  transform-origin: top;
}

/* Manifesto paragraph */
.manifesto {
  max-width: 54ch;
  margin: 0 auto;
  text-align: center;
  font-family: var(--body);
  font-weight: 300;
  font-size: clamp(15px, 1.15vw, 17px);
  line-height: 1.7;
  color: var(--ink-soft);
  text-wrap: pretty;
  opacity: 0;
  animation: fadeIn 1400ms ease 2400ms forwards;
}

.manifesto em {
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  color: var(--ink);
}

/* ---- Signup form ---- */
.signup {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  opacity: 0;
  animation: fadeIn 1400ms ease 2800ms forwards;
}

.signup-label {
  font-family: var(--body);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.signup-form {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--field-border);
  min-width: min(420px, 80vw);
  transition: border-color 300ms ease;
}

.signup-form:focus-within {
  border-color: var(--ink);
}

.signup-form input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 12px 4px;
  font-family: var(--body);
  font-size: 15px;
  color: var(--ink);
  font-weight: 400;
}

.signup-form input::placeholder {
  color: var(--ink-faint);
  font-style: italic;
  font-family: var(--display);
  font-size: 17px;
}

.signup-form button {
  background: transparent;
  border: none;
  padding: 12px 4px 12px 16px;
  cursor: pointer;
  font-family: var(--display);
  font-style: italic;
  font-size: 17px;
  color: var(--ink);
  letter-spacing: 0.01em;
  transition: transform 200ms ease, color 300ms ease;
}

.signup-form button:hover {
  transform: translateX(3px);
  color: var(--accent);
}

.signup-form button .arrow {
  display: inline-block;
  margin-left: 4px;
  font-style: normal;
  font-family: var(--body);
  font-weight: 300;
  transition: transform 300ms ease;
}

.signup-form button:hover .arrow {
  transform: translateX(3px);
}

.signup-hint {
  font-family: var(--body);
  font-size: 12px;
  color: var(--ink-faint);
  font-style: italic;
}

.signup-success {
  font-family: var(--display);
  font-style: italic;
  font-size: 17px;
  color: var(--ink);
  min-height: 24px;
}

/* ---- Footer ---- */
.bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font-family: var(--body);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  opacity: 0;
  animation: fadeIn 1200ms ease 3000ms forwards;
}

.bottom .left,
.bottom .right {
  display: flex;
  gap: 24px;
}

.bottom .page-num {
  font-family: var(--display);
  font-style: italic;
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-soft);
}

/* ---- Editorial layout variant ---- */
[data-layout="editorial"] .hero {
  text-align: left;
  align-items: flex-start;
  max-width: 680px;
  margin: 0;
  padding-left: clamp(24px, 8vw, 120px);
  padding-top: 6vh;
}

[data-layout="editorial"] .rule {
  margin: 0;
}

[data-layout="editorial"] .manifesto {
  text-align: left;
  margin: 0;
  max-width: 540px;
}

[data-layout="editorial"] .signup {
  align-items: flex-start;
}

[data-layout="editorial"] .hero .wordmark {
  font-size: clamp(52px, 8vw, 104px);
}

[data-layout="editorial"] .hero .tagline {
  max-width: 18ch;
}

/* ---- Palette switcher ---- */
.palette-switch {
  position: fixed;
  bottom: clamp(20px, 3vw, 36px);
  right: clamp(20px, 3vw, 36px);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  animation: fadeIn 1400ms ease 3200ms forwards;
  transition: background 600ms ease, border-color 600ms ease;
}

.palette-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  transition: all 300ms ease;
  padding: 0;
  position: relative;
}

.palette-btn:hover {
  color: var(--ink);
  border-color: var(--field-border);
}

.palette-btn.active {
  color: var(--ink);
  background: var(--bg);
  border-color: var(--rule);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

[data-palette="candlelight"] .palette-btn.active {
  background: var(--bg);
  border-color: var(--rule);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.palette-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* Tooltip */
.palette-btn .tip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(2px);
  background: var(--ink);
  color: var(--bg);
  font-family: var(--display);
  font-style: italic;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 2px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
  letter-spacing: 0.01em;
}

.palette-btn:hover .tip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Auto time-of-day toggle */
.palette-auto {
  font-family: var(--display);
  font-style: italic;
  font-size: 11px;
  color: var(--ink-faint);
  padding: 0 8px 0 4px;
  border-left: 1px solid var(--field-border);
  margin-left: 2px;
  height: 22px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: color 200ms ease;
  user-select: none;
}

.palette-auto:hover,
.palette-auto.active {
  color: var(--ink);
}

/* ---- Animations ---- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes inkBleed {
  0%   { opacity: 0; filter: blur(8px); letter-spacing: 0.02em; }
  60%  { opacity: 1; filter: blur(0.5px); }
  100% { opacity: 1; filter: blur(0); letter-spacing: -0.02em; }
}

@keyframes breathe {
  0%, 100% { opacity: 0.15; transform: scaleY(1); }
  50%       { opacity: 0.9;  transform: scaleY(1.02); }
}

@keyframes growRule {
  from { opacity: 0; transform: scaleY(0); }
  to   { opacity: 1; transform: scaleY(1); }
}

@keyframes flicker {
  0%,  100% { opacity: 0.85; transform: translateY(0) scale(1); }
  20%        { opacity: 1;    transform: translateY(-2px) scale(1.02); }
  45%        { opacity: 0.7;  transform: translateY(1px) scale(0.99); }
  65%        { opacity: 0.95; transform: translate(2px, -1px) scale(1.01); }
  80%        { opacity: 0.78; }
}

@keyframes drift1 {
  0%   { transform: translate(-10%, 0) rotate(-2deg); }
  100% { transform: translate(10%, -5%) rotate(2deg); }
}

@keyframes drift2 {
  0%   { transform: translate(5%, 2%) rotate(1deg); }
  100% { transform: translate(-8%, -3%) rotate(-1deg); }
}

.wash-a,
.wash-b {
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-direction: alternate;
}

.wash-a {
  animation-name: drift1;
  animation-duration: 38s;
}

.wash-b {
  animation-name: drift2;
  animation-duration: 52s;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .top .meta-sub { display: none; }
  .bottom .right { display: none; }
  .signup-form   { min-width: 0; width: 100%; }

  /* Collapse editorial left-offset so hero is readable on small screens */
  [data-layout="editorial"] .hero {
    padding-left: 0;
    align-items: center;
    text-align: center;
  }
  [data-layout="editorial"] .rule    { margin: 0 auto; }
  [data-layout="editorial"] .manifesto { text-align: center; }
  [data-layout="editorial"] .signup  { align-items: center; }
}

/* Tighten vertical rhythm on short viewports (landscape phone, etc.) */
@media (max-height: 640px) {
  .hero {
    gap: clamp(10px, 2vh, 20px);
    padding: 2vh 0;
    justify-content: flex-start;
  }
  .rule { height: 36px; }
}
