/* ============================================
   ProseClock — "Library at Dusk" Edition
   ============================================ */

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

:root {
  /* Dark palette */
  --night: #0D0B09;
  --charcoal: #1C1917;
  --stone: #292524;
  --stone-light: #44403C;

  /* Light palette */
  --cream: #F5F0E6;
  --parchment: #FAFAF7;

  /* Text */
  --ink: #1C1917;
  --ink-light: #57534E;
  --ghost: #A8A29E;
  --light-text: #E7E5E4;
  --light-text-muted: #A8A29E;

  /* Accent */
  --gold: #C8A84E;
  --gold-bright: #DDB94F;
  --gold-dim: rgba(200, 168, 78, 0.12);

  /* Wood */
  --walnut-light: #A67C52;
  --walnut: #8B5E34;
  --walnut-dark: #6B4226;

  /* E-ink device */
  --eink-bg: #DDDAD2;
  --eink-text: #1C1A17;

  /* Fonts */
  --font-display: 'Fraunces', 'Georgia', serif;
  --font-quote: 'Cormorant Garamond', 'Georgia', serif;
  --font-body: 'Outfit', system-ui, sans-serif;
  --font-device: 'Literata', 'Georgia', serif;

  --frame-radius: 6px;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--night);
  line-height: 1.6;
  overflow-x: hidden;
}


/* ============ HERO ============ */

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--night);
  padding: 2rem;
  overflow: hidden;
}

/* Film grain overlay */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  opacity: 0.4;
  pointer-events: none;
  z-index: 1;
}

/* Warm ambient glow behind clock */
.hero::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  width: 900px;
  height: 700px;
  background: radial-gradient(ellipse, rgba(200, 168, 78, 0.06) 0%, transparent 65%);
  pointer-events: none;
  z-index: 1;
}

.hero-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.25rem;
}

.hero-brand {
  font-family: var(--font-display);
  font-size: clamp(0.9rem, 1.4vw, 1.15rem);
  font-weight: 400;
  color: var(--gold);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0;
  animation: fadeDown 1s ease 0.2s forwards;
}

.hero-tagline {
  font-family: var(--font-body);
  font-size: clamp(0.8rem, 1.1vw, 0.95rem);
  font-weight: 300;
  color: var(--light-text-muted);
  letter-spacing: 0.06em;
  opacity: 0;
  animation: fadeUp 1s ease 0.6s forwards;
}


/* ============ CLOCK FRAME — Xteink X4 inspired ============ */
/* Thin bezels for a modern, screen-forward look              */

.clock-frame {
  position: relative;
  width: 114mm;
  max-width: 90vw;
  aspect-ratio: 114 / 69;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.1mm 3mm;
  overflow: hidden;
  border-radius: var(--frame-radius);
  opacity: 0;
  animation: fadeScale 0.9s ease 0.3s forwards;

  /* Walnut wood: layered grain */
  background:
    repeating-linear-gradient(88deg,
      transparent,
      transparent 2px,
      rgba(139, 94, 52, 0.06) 2px,
      rgba(139, 94, 52, 0.06) 3px),
    repeating-linear-gradient(91deg,
      rgba(166, 124, 82, 0.12),
      rgba(166, 124, 82, 0.12) 14px,
      rgba(139, 94, 52, 0.18) 14px,
      rgba(139, 94, 52, 0.18) 30px,
      rgba(166, 124, 82, 0.08) 30px,
      rgba(166, 124, 82, 0.08) 38px),
    linear-gradient(176deg,
      #A67C52 0%,
      #8B5E34 35%,
      #7A5230 55%,
      #6B4226 100%);

  /* Dramatic glow on dark background */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(0, 0, 0, 0.3),
    0 4px 16px rgba(0, 0, 0, 0.4),
    0 16px 48px rgba(0, 0, 0, 0.3),
    0 0 80px rgba(200, 168, 78, 0.05),
    0 0 160px rgba(200, 168, 78, 0.03);
}


/* ============ E-INK SCREEN (800×480, 5:3) ============ */

.clock-screen {
  position: relative;
  background: var(--eink-bg);
  border-radius: 2px;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 3.5% 4%;
  overflow: hidden;
  container-type: inline-size;

  box-shadow:
    inset 0 1px 3px rgba(0, 0, 0, 0.06),
    inset 0 0 1px rgba(0, 0, 0, 0.04);
}


/* ============ LOADING ============ */

.clock-loading {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex: 1;
}

.clock-loading[hidden] {
  display: none;
}

.loading-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--eink-text);
  opacity: 0.25;
  animation: loadPulse 1.4s ease-in-out infinite;
}

.loading-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes loadPulse {

  0%,
  100% {
    opacity: 0.12;
    transform: scale(0.8);
  }

  50% {
    opacity: 0.4;
    transform: scale(1);
  }
}


/* ============ CLOCK CONTENT ============ */

.clock-content {
  flex: 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100%;
  font-family: var(--font-device);
  animation: fadeIn 0.6s ease;
  transition: opacity 0.4s ease;
}

/* 24h time — top center */
.clock-time {
  text-align: center;
  font-family: var(--font-device);
  font-size: 4.2cqi;
  font-weight: 800;
  color: var(--eink-text);
  padding-bottom: 0.2em;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

/* Quote wrapper — vertically centers the quote in middle row */
.clock-quote-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 0;
  overflow: hidden;
}

/* Truncation ellipsis overlays */
.clock-quote-wrap.trunc-top::before {
  content: '…';
  position: absolute;
  top: 0;
  left: 0;
  padding-right: 0.3em;
  background: var(--eink-bg);
  font-family: var(--font-device);
  font-size: 5.2cqi;
  line-height: 1.25;
  color: var(--eink-text);
  z-index: 1;
}

.clock-quote-wrap.trunc-bottom::after {
  content: '…';
  position: absolute;
  bottom: 0;
  right: 0;
  padding-left: 0.3em;
  background: var(--eink-bg);
  font-family: var(--font-device);
  font-size: 5.2cqi;
  line-height: 1.25;
  color: var(--eink-text);
  z-index: 1;
}

/* Quote — left-aligned, max 5 lines, tight line-height */
.clock-quote {
  font-family: var(--font-device);
  font-size: 5.2cqi;
  font-weight: 400;
  line-height: 1.25;
  color: var(--eink-text);
  text-align: left;
  position: relative;
  max-height: 6.25em; /* 5 lines × 1.25 line-height */
  overflow: hidden;
}

/* Time reference in quote — bold, not highlighted */
.clock-quote strong {
  font-weight: 700;
}

/* Attribution — right-aligned, below quote */
.clock-cite {
  text-align: right;
  padding-top: 0.2em;
}

.clock-cite-author,
.clock-cite-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-device);
  font-size: 4.6cqi;
  color: var(--eink-text);
  line-height: 1.3;
}

.clock-cite-title {
  font-style: italic;
}


/* ============ SCROLL HINT ============ */

.hero-scroll-hint {
  position: absolute;
  bottom: 2.5rem;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--ghost);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0;
  animation: fadeUp 1s ease 1.2s forwards;
  transition: opacity 0.5s ease;
}

.hero-scroll-hint.hidden {
  opacity: 0 !important;
  pointer-events: none;
}

.hero-scroll-hint svg {
  animation: hintBounce 2.5s ease-in-out infinite;
  stroke: var(--stone-light);
}

@keyframes hintBounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(5px);
  }
}


/* ============ NAVIGATION ============ */

.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(250, 250, 247, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding: 0.875rem clamp(1.5rem, 4vw, 3rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transform: translateY(-100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.site-nav.visible {
  transform: translateY(0);
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  gap: 2.5rem;
  list-style: none;
}

.nav-links a {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ghost);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.25s ease;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--gold);
  transition: width 0.3s ease;
}

.nav-links a:hover {
  color: var(--ink);
}

.nav-links a:hover::after {
  width: 100%;
}


/* ============ SECTIONS SHARED ============ */

.section {
  padding: clamp(5rem, 10vw, 10rem) clamp(1.5rem, 5vw, 4rem);
  max-width: 1080px;
  margin: 0 auto;
}

.section-label {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gold);
  margin-bottom: 1.25rem;
  display: block;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 1.75rem;
}

.section-body {
  font-size: clamp(0.95rem, 1.3vw, 1.08rem);
  color: var(--ink-light);
  max-width: 560px;
  line-height: 1.75;
  font-weight: 400;
}


/* ============ REVEAL ANIMATION ============ */

.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}


/* ============ ABOUT SECTION ============ */

.about-section {
  background: var(--parchment);
}

.about-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5rem;
  align-items: start;
}

.about-stats {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  padding-top: 0.5rem;
}

.stat-card {
  padding: 0;
  border-left: 2px solid var(--gold);
  padding-left: 1.5rem;
}

.stat-number {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.5vw, 2.8rem);
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 0.4rem;
}

.stat-label {
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--ink-light);
  line-height: 1.5;
}

/* Stagger stats */
.about-stats .reveal:nth-child(2) {
  transition-delay: 0.12s;
}

.about-stats .reveal:nth-child(3) {
  transition-delay: 0.24s;
}


/* ============ FEATURES SECTION ============ */

.features-section {
  background: var(--charcoal);
  position: relative;
}

.features-section .section-title {
  color: var(--light-text);
}

.features-section .section-body {
  color: var(--light-text-muted);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-top: 3.5rem;
}

.feature-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 2rem;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.feature-card:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(200, 168, 78, 0.15);
}

.feature-number {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
  display: block;
}

.feature-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  color: var(--light-text);
}

.feature-desc {
  font-size: 0.88rem;
  color: var(--light-text-muted);
  line-height: 1.65;
  font-weight: 300;
}

/* Stagger feature cards */
.features-grid .reveal:nth-child(2) {
  transition-delay: 0.08s;
}

.features-grid .reveal:nth-child(3) {
  transition-delay: 0.16s;
}

.features-grid .reveal:nth-child(4) {
  transition-delay: 0.24s;
}


/* ============ GALLERY SECTION ============ */

.gallery-section {
  background: var(--parchment);
}

.gallery-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: auto auto;
  gap: 1rem;
  margin-top: 3rem;
}

.gallery-placeholder {
  border-radius: 4px;
  background: linear-gradient(150deg, #E8E2D8 0%, #D9D0C3 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ghost);
  font-size: 0.78rem;
  font-style: italic;
  font-weight: 300;
  min-height: 200px;
}

.gallery-placeholder:first-child {
  grid-row: span 2;
  min-height: 420px;
}


/* ============ CTA SECTION ============ */

.cta-section {
  text-align: center;
  background: var(--night);
  color: var(--light-text);
  padding: clamp(5rem, 10vw, 10rem) 2rem;
  position: relative;
  overflow: hidden;
}

/* Subtle radial glow */
.cta-section::before {
  content: '';
  position: absolute;
  top: -30%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(ellipse, rgba(200, 168, 78, 0.05) 0%, transparent 70%);
  pointer-events: none;
}

.cta-section .section-label {
  color: var(--gold);
}

.cta-section .section-title {
  color: var(--light-text);
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.cta-price {
  font-family: var(--font-display);
  font-size: clamp(3rem, 6vw, 4.5rem);
  font-weight: 700;
  color: var(--light-text);
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
}

.cta-price-note {
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--light-text-muted);
  margin-bottom: 2.5rem;
  letter-spacing: 0.03em;
}

.cta-button {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 1rem 2.75rem;
  background: var(--gold);
  color: var(--night);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(200, 168, 78, 0.25);
  background: var(--gold-bright);
}


/* ============ FOOTER ============ */

.site-footer {
  background: var(--night);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding: 3rem 2rem;
  text-align: center;
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  color: var(--light-text-muted);
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.footer-text {
  font-size: 0.72rem;
  font-weight: 300;
  color: var(--stone-light);
}


/* ============ ANIMATIONS ============ */

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeDown {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeScale {
  from {
    opacity: 0;
    transform: scale(0.97);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}


/* ============ RESPONSIVE ============ */

@media (max-width: 768px) {
  .about-layout {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .gallery-placeholder:first-child {
    grid-row: span 1;
    min-height: 200px;
  }

  .nav-links {
    gap: 1.25rem;
  }

  .nav-links a {
    font-size: 0.72rem;
  }

  .clock-frame {
    width: 90vw;
  }
}

@media (max-width: 480px) {
  .nav-links {
    display: none;
  }
}