/* ==========================================================================
   The Islamabad Frontier
   ========================================================================== */

@font-face {
  font-family: "EB Garamond";
  src: url("fonts/eb-garamond-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("fonts/eb-garamond-italic-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0a0a09;
  --ink: #ebe5d8;
  --ink-2: rgba(235, 229, 216, 0.68);
  --ink-3: rgba(235, 229, 216, 0.5);
  --line: rgba(235, 229, 216, 0.16);
  --line-strong: rgba(235, 229, 216, 0.3);
  --error: #c08466;

  --serif: "EB Garamond", Garamond, "Adobe Garamond Pro", "Times New Roman", serif;
  --gutter: clamp(20px, 6vw, 72px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
}

h1, h2, p { margin: 0; }
a { color: inherit; }
[hidden] { display: none !important; }

::selection { background: rgba(235, 229, 216, 0.2); }

:focus-visible {
  outline: 1px solid var(--ink-2);
  outline-offset: 6px;
}

/* ---------- Views ---------- */

.view {
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(48px + env(safe-area-inset-top, 0px)) var(--gutter) calc(48px + env(safe-area-inset-bottom, 0px));
}

.js .view {
  opacity: 0;
  transition: opacity 0.9s var(--ease);
}
.js .view.in { opacity: 1; }

/* ---------- Landing ---------- */

.landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  text-align: center;
}

.name {
  font-weight: 400;
  font-size: clamp(1.15rem, 2.1vw, 1.6rem);
  line-height: 1.5;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  text-wrap: balance;
  /* tracking adds space after the last letter; pull it back so the line stays centred */
  margin-right: -0.32em;
}

.masthead {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.tagline {
  font-style: italic;
  font-size: clamp(0.95rem, 1.15vw, 1.05rem);
  letter-spacing: 0.02em;
  color: var(--ink-3);
}

.rule {
  display: block;
  width: 40px;
  height: 1px;
  background: var(--line-strong);
}

.request-link {
  font-style: italic;
  font-size: clamp(1rem, 1.3vw, 1.125rem);
  letter-spacing: 0.02em;
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 7px;
  transition: color 0.5s var(--ease), text-decoration-color 0.5s var(--ease);
}
.request-link:hover {
  color: var(--ink);
  text-decoration-color: var(--ink-2);
}

/* Load sequence: the name, then the rule, then the invitation. */
.js .landing .name,
.js .landing .tagline,
.js .landing .rule,
.js .landing .request-link {
  opacity: 0;
  transition: opacity 1.8s var(--ease), transform 1.8s var(--ease), color 0.5s var(--ease), text-decoration-color 0.5s var(--ease);
}
.js .landing .rule { transform: scaleX(0); }
.js .landing.in .name { opacity: 1; transition-delay: 0.2s; }
.js .landing.in .tagline { opacity: 1; transition-delay: 0.7s; }
.js .landing.in .rule { opacity: 1; transform: none; transition-delay: 1.1s; }
.js .landing.in .request-link { opacity: 1; transition-delay: 1.5s, 1.5s, 0s, 0s; }

/* ---------- Request ---------- */

.request {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.request-inner {
  width: 100%;
  max-width: 34rem;
  padding-block: clamp(24px, 8vh, 96px);
}

.kicker {
  font-size: 12px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.request-title {
  margin-top: 18px;
  font-weight: 400;
  font-style: italic;
  font-size: clamp(1.6rem, 3vw, 2rem);
  line-height: 1.2;
  outline: none;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin-top: 48px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 12px;
  line-height: 1.6;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  transition: color 0.4s var(--ease);
}
.field:focus-within label { color: var(--ink-2); }

.field input,
.field textarea {
  width: 100%;
  padding: 6px 0 10px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  color: var(--ink);
  font: inherit;
  font-size: 1.1rem;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.4s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
.field textarea { resize: vertical; min-height: 84px; }
.field input:focus,
.field textarea:focus { border-bottom-color: var(--ink); }
.form.touched .field input:invalid,
.form.touched .field textarea:invalid { border-bottom-color: var(--error); }

.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  box-shadow: 0 0 0 1000px var(--bg) inset;
  caret-color: var(--ink);
}

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  margin-top: 8px;
}

.btn {
  padding: 15px 30px 14px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 0;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease), border-color 0.5s var(--ease);
}
.btn:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.btn[disabled] { opacity: 0.5; cursor: progress; }

.form-status {
  font-style: italic;
  font-size: 1rem;
  color: var(--ink-3);
}
.form-status.error { color: var(--error); }

.received {
  margin-top: 48px;
  outline: none;
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}
.received.in { opacity: 1; }
.received p {
  max-width: 26ch;
  font-size: clamp(1.3rem, 2.4vw, 1.6rem);
  line-height: 1.4;
  text-wrap: balance;
}

.back {
  display: inline-block;
  margin-top: 56px;
  font-style: italic;
  font-size: 1rem;
  color: var(--ink-3);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
  transition: color 0.4s var(--ease), text-decoration-color 0.4s var(--ease);
}
.back:hover { color: var(--ink); text-decoration-color: var(--ink-2); }

@media (max-width: 520px) {
  .name { letter-spacing: 0.26em; margin-right: -0.26em; }
  .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .js .view,
  .js .landing .name,
  .js .landing .tagline,
  .js .landing .rule,
  .js .landing .request-link,
  .received {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
