/*
 * phibonai.com: the home page and its two short pages.
 * Two colours only (navy #130C4F primary, brick #B83F40 accent) on white;
 * one family, Yekan Bakh, in two weights.
 */

@font-face {
  font-family: 'Yekan Bakh';
  src: url('/assets/fonts/YekanBakh-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Yekan Bakh';
  src: url('/assets/fonts/YekanBakh-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}

:root {
  --navy: #130c4f;
  --brick: #b83f40;
  --line: rgba(19, 12, 79, 0.3);
  /* The page's side margin: 256px each side at 1440, easing down to 24px at 768 and below. */
  --gutter: clamp(24px, calc(34.5vw - 241px), 256px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

* {
  -webkit-tap-highlight-color: transparent;
}

html {
  background: #ffffff;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: #ffffff;
  color: var(--navy);
  font-family: 'Yekan Bakh', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* Selected text: a light wash of navy (12% of #130C4F on white), never the browser's blue.
   The text keeps its own colour: navy stays navy, brick stays brick. */
::selection {
  background: #e3e2ea;
}

a:focus-visible,
button:focus-visible {
  outline: 1px solid var(--navy);
  outline-offset: 4px;
}

.accent {
  color: var(--brick);
  font-weight: 600;
}

/* ---- The golden shell, pinned behind the page; the letter scrolls over it ---- */

.shell {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.shell canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.shell canvas.is-on {
  opacity: 1;
}

/* ---- Page frame ---- */

.page {
  position: relative;
  min-height: 100vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 0 var(--gutter);
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 32px;
  padding-top: clamp(20px, 4.5vh, 44px);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.wordmark img {
  display: block;
  width: 160px;
  height: 26px;
}

main {
  flex: 1;
}

/* ---- The letter ---- */

.letter {
  padding-top: clamp(48px, 11vh, 128px);
}

.letter h1 {
  margin: 0;
  max-width: 12em;
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 600;
  line-height: 1.35;
}

/* The headline ends in the red dot: the reader, in the shell. */
.dot {
  display: inline-block;
  width: 0.2em;
  height: 0.2em;
  margin-right: 0.08em;
  border-radius: 50%;
  background: var(--brick);
}

.body {
  max-width: 36em;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding-top: 44px;
  font-size: 18px;
  line-height: 2.1;
}

.body p {
  margin: 0;
}

.body strong {
  font-weight: 600;
}

/* Something she might say to it, as a chat message: a soft bubble that sizes to its words
   (wrapping at the column's width), with one sharp corner like a message she sent. Barely
   tinted at rest; the tint deepens a little on hover. */
.body .said {
  align-self: flex-start;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: -8px;
  padding: 10px 18px;
  background: #f6f5f8;
  border-radius: 20px;
  border-end-start-radius: 6px;
  font-size: 17px;
  line-height: 1.9;
  transition: background-color 0.2s ease;
}

.body .said:hover {
  background: #ecebf1;
}

/* ---- The login field: a dashed line, a number, «ورود» ---- */

.login {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px dashed var(--line);
  transition: border-color 0.2s ease;
}

.login:focus-within {
  border-bottom-style: solid;
  border-bottom-color: var(--navy);
}

.login input {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: none;
  background: transparent;
  color: var(--navy);
  font: inherit;
  /* 16px or more: iOS zooms the page into any field set smaller. */
  font-size: 16px;
  text-align: right;
  -webkit-appearance: none;
  appearance: none;
}

.login input::placeholder {
  color: rgba(19, 12, 79, 0.45);
  opacity: 1;
}

/* A saved number filled in by the browser keeps the page's colours. */
.login input:-webkit-autofill,
.login input:-webkit-autofill:hover,
.login input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--navy);
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset;
  box-shadow: 0 0 0 1000px #ffffff inset;
  caret-color: var(--navy);
  transition: background-color 9999s ease-out 0s;
}

.login input:autofill {
  background: transparent;
}

.login button {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--navy);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.login button:disabled {
  cursor: default;
  opacity: 0.45;
}

.login-error {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  margin: 0;
  color: var(--brick);
  font-size: 13px;
  line-height: 1.6;
}

.login-error:empty {
  display: none;
}

/* Room for the line under the field, so it never covers what follows. */
.login:has(.login-error:not(:empty)) {
  margin-bottom: 3.4em;
}

.login--top:has(.login-error:not(:empty)) {
  margin-bottom: 0;
}

.login--top {
  width: 300px;
}

.login--top input,
.login--top button {
  min-height: 44px;
  font-size: 16px;
}

.login--end {
  width: 100%;
  max-width: 340px;
  margin-top: 8px;
}

/* Right under the headline, on phones only: the end of the letter is too far down. */
.login--hero {
  display: none;
  margin-top: 28px;
}

.login--hero input,
.login--hero button {
  min-height: 48px;
  font-size: 16px;
}

/* The honeypot: out of sight and out of the tab order; only a bot fills it. */
.login .hp {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* Sent: the field gives way to one quiet line. */
.login.is-done {
  border-bottom-color: transparent;
}

.login-done {
  margin: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 16px;
  line-height: 1.9;
}

/* In the header the line takes the room it needs, on one line. */
.login--top.is-done {
  width: auto;
}

.login--top .login-done {
  font-size: 15px;
  white-space: nowrap;
}

.login--end input,
.login--end button {
  min-height: 52px;
  font-size: 17px;
}

/* The header's right-hand side (left, in RTL): the request field, then «ورود اعضا». */
.top-actions {
  display: flex;
  align-items: center;
  gap: 28px;
}

/* Members log in to the app. */
.members {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
}

.members:hover {
  color: var(--brick);
}

/* ---- Footer: one small line ---- */

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 22px;
  padding: clamp(64px, 12vh, 120px) 0 10px;
  font-size: 12.5px;
}

.foot a {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  min-height: 44px;
}

.foot a:hover {
  color: var(--brick);
}

/* ---- The two short pages and the 404 ---- */

.doc {
  max-width: 36em;
  padding-top: clamp(48px, 9vh, 96px);
}

.doc h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 40px);
  font-weight: 600;
  line-height: 1.4;
}

.doc h2 {
  margin: 40px 0 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.8;
}

.doc p,
.doc li {
  font-size: 17px;
  line-height: 2.1;
}

.doc p {
  margin: 12px 0 0;
}

.doc ul {
  margin: 12px 0 0;
  padding: 0 1.2em 0 0;
}

.doc strong {
  font-weight: 600;
}

.doc li + li {
  margin-top: 6px;
}

.doc .lead {
  margin-top: 20px;
}

.doc .meta {
  margin-top: 8px;
  font-size: 14px;
  opacity: 0.7;
}

.doc a {
  border-bottom: 1px dashed var(--line);
}

.doc a:hover {
  color: var(--brick);
  border-bottom-color: var(--brick);
}

/* ---- The reveal: the letter prints in, block by block, 90ms apart.
   A fade only: nothing moves, so a refresh never looks like the page jumping. ---- */

@keyframes appear {
  from {
    opacity: 0;
  }
}

[data-reveal] {
  animation: appear 0.5s ease-out both;
}

[data-reveal='1'] { animation-delay: 90ms; }
[data-reveal='2'] { animation-delay: 180ms; }
[data-reveal='3'] { animation-delay: 270ms; }
[data-reveal='4'] { animation-delay: 360ms; }
[data-reveal='5'] { animation-delay: 450ms; }
[data-reveal='6'] { animation-delay: 540ms; }
[data-reveal='7'] { animation-delay: 630ms; }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    animation-duration: 0.3s;
    animation-delay: 0s;
  }

  .shell canvas {
    transition: none;
  }
}

/* ---- Phone ---- */

@media (max-width: 640px) {
  .login--top {
    display: none;
  }

  .login--hero {
    display: flex;
  }

  .wordmark img {
    width: 135px;
    height: 22px;
  }

  .body {
    gap: 22px;
    padding-top: 32px;
    font-size: 17px;
    line-height: 2;
  }

  .login--end {
    max-width: none;
  }

  .body .said {
    font-size: 16px;
  }

  .foot {
    gap: 0 18px;
  }
}
