/* ===== Tokens ===== */
:root {
  --cream: #f4ecd2;
  --cream-warm: #efe6c5;
  --ink: #0a0a0a;
  --ink-soft: #1a1a1a;
  --rule: rgba(10, 10, 10, 0.18);

  --serif: 'Cormorant Garamond', 'Playfair Display', Georgia, 'Times New Roman', serif;
  --grotesque: 'Helvetica Neue', Helvetica, Arial, sans-serif;

  --pad: clamp(20px, 4vw, 48px);
  --tag-size: clamp(10px, 0.85vw, 12px);
  --wordmark-size: clamp(72px, 14vw, 240px);
  --tagline-size: clamp(16px, 1.6vw, 22px);
}

/* ===== Self-hosted display faces ===== */
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/public/fonts/cormorant-garamond-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('/public/fonts/playfair-display-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ===== Reset-ish ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }

body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--grotesque);
  font-size: 16px;
  line-height: 1.4;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Stage layout ===== */
.stage {
  position: relative;
  width: 100vw;
  height: 100dvh;
  height: 100svh;
  padding: var(--pad);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

/* Visual layer fills the whole stage, sits behind everything. */
.visual-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* ===== ASCII layer ===== */
.ascii-stack {
  position: absolute;
  inset: 0;
  z-index: 2; /* above halftone slides + scrim, still behind brand/tags */
  margin: 0;
  padding: 0;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: clamp(9px, 1.1vw, 13px);
  line-height: 1;
  letter-spacing: 0;
  color: var(--ink);
  opacity: 0.08;
  white-space: pre;
  overflow: hidden;
  user-select: none;
  pointer-events: none;
  /* Tighter horizontal gridding so chars feel like a halftone field */
  font-variant-ligatures: none;
}
body[data-visual="none"] .ascii-stack { display: none; }

/* ===== Halftone slides ===== */
.halftone-stack {
  position: absolute;
  inset: 0;
}
.halftone-stack::after {
  /* Cream scrim keeps black type legible over dark photography. */
  content: '';
  position: absolute;
  inset: 0;
  background: var(--cream);
  opacity: 0.4;
  pointer-events: none;
  z-index: 1;
}
.halftone-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  animation: hf-cycle calc(var(--n, 1) * 9s) ease-in-out infinite;
}
@keyframes hf-cycle {
  0%, 4%   { opacity: 0; transform: scale(1.06); }
  8%, 30%  { opacity: 0.85; transform: scale(1.0); }
  34%      { opacity: 0; transform: scale(0.98); }
  100%     { opacity: 0; transform: scale(0.98); }
}

/* ===== Corner tags ===== */
.tag {
  position: absolute;
  z-index: 2;
  font-family: var(--grotesque);
  font-size: var(--tag-size);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--ink);
  padding: 4px 8px;
  border: 1px solid var(--ink);
  background: rgba(244, 236, 210, 0.7);
  backdrop-filter: blur(2px);
}
.tag--tl { top: var(--pad); left: var(--pad); }
.tag--tr { top: var(--pad); right: var(--pad); }
.tag--bl { bottom: var(--pad); left: var(--pad); }
.tag--br { bottom: var(--pad); right: var(--pad); }

@media (max-width: 560px) {
  .tag--bl { display: none; }
}

/* ===== Brand wordmark ===== */
.brand {
  position: relative;
  z-index: 1;
  grid-row: 2;
  align-self: center;
  justify-self: center;
  text-align: center;
  max-width: 96vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(14px, 2.4vw, 28px);
}
.wordmark {
  width: clamp(180px, 36vw, 380px);
  aspect-ratio: 921 / 431;
  color: var(--ink);
  background: currentColor;
  -webkit-mask: url('/public/logo.svg') center / contain no-repeat;
          mask: url('/public/logo.svg') center / contain no-repeat;
}
.company-name {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(48px, 11vw, 156px);
  line-height: normal;
  letter-spacing: -0.1em;
  color: var(--ink);
  white-space: nowrap;
  text-align: center;
}
@media (max-width: 720px) {
  .company-name {
    white-space: normal;
    line-height: 1.05;
  }
}

.company-suffix {
  margin: 0;
  font-family: var(--grotesque);
  font-weight: 600;
  font-size: clamp(11px, 1.1vw, 14px);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink);
  text-align: center;
}

.flag {
  width: clamp(44px, 5.4vw, 72px);
  aspect-ratio: 750 / 554;
  color: var(--ink);
  background: currentColor;
  -webkit-mask: url('/public/sg_flag.svg') center / contain no-repeat;
          mask: url('/public/sg_flag.svg') center / contain no-repeat;
  opacity: 0.9;
}

/* ===== Copyright ===== */
.copyright {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: calc(var(--pad) - 4px);
  transform: translateX(-50%);
  font-family: var(--grotesque);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.55;
  white-space: nowrap;
}
@media (max-width: 560px) {
  .copyright { font-size: 9px; letter-spacing: 0.18em; }
}

/* ===== CONTACT pill ===== */
.contact-pill {
  position: absolute;
  z-index: 2;
  bottom: var(--pad);
  right: var(--pad);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--grotesque);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  border-radius: 999px;
  transition: transform 120ms ease, background 120ms ease;
}
.contact-pill:hover { transform: translateY(-1px); background: var(--ink-soft); }
.contact-pill:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.contact-pill svg { transition: transform 180ms ease; }
.contact-pill:hover .contact-pill__arrow { transform: translateX(3px); }

.contact-pill__icon { display: none; }

@media (max-width: 560px) {
  .contact-pill {
    width: 56px;
    height: 56px;
    padding: 0;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    gap: 0;
  }
  .contact-pill__label,
  .contact-pill__arrow { display: none; }
  .contact-pill__icon { display: block; }
  .contact-pill:hover { transform: translateY(-1px); }
}

/* ===== Dialog ===== */
.contact-dialog {
  border: 1px solid var(--ink);
  background: var(--cream-warm);
  color: var(--ink);
  padding: 0;
  max-width: 460px;
  width: calc(100vw - 32px);
  border-radius: 4px;
  box-shadow: 0 30px 80px -20px rgba(10, 10, 10, 0.45);
}
.contact-dialog::backdrop {
  background: rgba(10, 10, 10, 0.55);
  backdrop-filter: blur(4px);
}
.contact-dialog[open] {
  animation: dialog-in 220ms cubic-bezier(.2,.7,.25,1);
}
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

/* ===== Form ===== */
.contact-form { display: grid; gap: 16px; padding: 24px; }
.contact-form__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 4px;
}
.contact-form__head h2 {
  margin: 0;
  font-family: var(--grotesque);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.contact-form__close {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
}
.contact-form__close:hover { background: rgba(10, 10, 10, 0.08); }

.contact-form label { display: grid; gap: 6px; }
.contact-form label > span {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 600;
}
.contact-form input,
.contact-form textarea {
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 2px;
  padding: 10px 12px;
  color: var(--ink);
  outline: none;
  resize: vertical;
}
.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.12);
}

.hp { position: absolute; left: -9999px; opacity: 0; pointer-events: none; }

.contact-form__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}
.contact-form__status {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.04em;
  min-height: 1em;
}
.contact-form__status[data-state="ok"]   { color: #2c5b2e; }
.contact-form__status[data-state="err"]  { color: #8a2a1f; }
.contact-form__send {
  background: var(--ink);
  color: var(--cream);
  padding: 12px 20px;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  border-radius: 999px;
}
.contact-form__send:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  .halftone-slide { animation-duration: calc(var(--n, 1) * 18s); }
  .ascii-stack    { opacity: 0.1; }
  .contact-dialog[open] { animation: none; }
}
