/* Shared look for the contact and legal pages (every language), matching the app. */

:root {
  color-scheme: light;
  --bg: #f6f6f3;
  --surface: #ffffff;
  --border: #e7e6e1;
  --text: #141413;
  --text-2: #52514e;
  --text-3: #6f6e69;
  --brand: #00502e;
  --brand-tint: #eaf2ec;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --page: 760px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Other scripts: Latin fonts first, then the language's own (loaded by each page) or the system's. */
html:lang(ar),
html:lang(fa) {
  --serif: "Newsreader", "Noto Naskh Arabic", Georgia, serif;
  --font: "Inter", "Noto Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
}

html:lang(hi) {
  --serif: "Newsreader", "Noto Serif Devanagari", Georgia, serif;
  --font: "Inter", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", sans-serif;
}

html:lang(zh) {
  --serif: "Newsreader", "Noto Serif SC", "Songti SC", serif;
  --font: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

html:lang(ja) {
  --serif: "Newsreader", "Noto Serif JP", "Hiragino Mincho ProN", serif;
  --font: "Inter", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, "Noto Sans JP", sans-serif;
}

html:lang(ko) {
  --serif: "Newsreader", "Noto Serif KR", serif;
  --font: "Inter", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  word-break: keep-all;
}

html:is(:lang(ar), :lang(fa), :lang(hi), :lang(zh), :lang(ja), :lang(ko)) :is(h1, h2, .contact-title, .sent h2) {
  letter-spacing: 0;
}

html:is(:lang(ar), :lang(fa), :lang(hi)) body {
  line-height: 1.8;
}

html:is(:lang(ar), :lang(fa), :lang(hi)) .contact-title {
  line-height: 1.3;
}

/* Japanese headings break between phrases, not inside a word. */
html:lang(ja) :is(h1, h2, .contact-title) {
  word-break: auto-phrase;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand);
}

/* The contact page is wider: intro beside the form. */
.wide {
  --page: 1040px;
}

/* A floating bar: a pill inset from the page's edges that stays at the top while the
   page scrolls, with a deeper shadow once it does. The space around it lets clicks through. */
.top {
  position: sticky;
  top: 12px;
  z-index: 50;
  margin-top: 12px;
  margin-bottom: 20px;
  padding-inline: 16px;
  pointer-events: none;
}

.top .nav {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(20, 20, 19, 0.08);
  border-radius: 999px;
  box-shadow:
    0 1px 2px rgba(20, 20, 19, 0.04),
    0 10px 30px -18px rgba(20, 20, 19, 0.28);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  backdrop-filter: saturate(1.6) blur(16px);
  transition: box-shadow 0.2s, background-color 0.2s;
}

.top.is-scrolled .nav {
  background: rgba(255, 255, 255, 0.84);
  box-shadow:
    0 1px 2px rgba(20, 20, 19, 0.05),
    0 16px 40px -18px rgba(20, 20, 19, 0.34);
}

/* Logo, menu in the middle, "Log in" (or the avatar) at the end. */
.nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas: "brand links end";
  align-items: center;
  gap: 12px;
  max-width: var(--page);
  height: 60px;
  margin: 0 auto;
  padding: 0 10px 0 16px;
}

.nav > .brand {
  grid-area: brand;
  justify-self: start;
}

.nav > :last-child {
  grid-area: end;
  justify-self: end;
}

/* The menu in the middle of the top bar. */
.nav-links {
  grid-area: links;
  display: flex;
  justify-content: center;
  gap: 2px;
}

.nav-links a {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}

.nav-links a:hover {
  background: rgba(20, 20, 19, 0.05);
  color: var(--text);
}

.nav-links a[aria-current="page"] {
  color: var(--text);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
}

/* "Log in", like the landing page's. */
.open {
  padding: 8px 18px;
  border: 1px solid #d2d0c6;
  border-radius: 999px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s;
}

.open:hover {
  background: var(--surface);
  border-color: var(--text-3);
}

/* Signed in: the avatar, opening a small menu (built by account.js). */
.account {
  position: relative;
}

.avatar-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--brand-tint);
  color: var(--brand);
  font-size: 14px;
  font-weight: 600;
  transition: box-shadow 0.15s;
}

.avatar-btn:hover .avatar,
.avatar-btn[aria-expanded="true"] .avatar {
  box-shadow: 0 0 0 3px var(--brand-tint);
}

.menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  width: 240px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(20, 20, 19, 0.14);
  animation: menu-in 0.12s ease-out;
}

.menu[hidden] {
  display: none;
}

.menu-head {
  display: grid;
  margin-bottom: 4px;
  padding: 8px 12px 10px;
  border-bottom: 1px solid var(--border);
  line-height: 1.35;
}

.menu-head strong,
.menu-head span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-head strong {
  font-size: 13.5px;
  font-weight: 600;
}

.menu-head span {
  color: var(--text-3);
  font-size: 12.5px;
}

.menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
}

.menu a:hover,
.menu a:focus-visible {
  background: #f6f6f3;
  outline: none;
}

.menu svg {
  flex: none;
  color: var(--text-2);
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.doc {
  max-width: var(--page);
  margin: 0 auto;
  padding: 36px 40px 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h2 {
  margin: 36px 0 8px;
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h3 {
  margin: 20px 0 4px;
  font-size: 15px;
}

p,
ul {
  margin: 0 0 12px;
}

ul {
  padding-inline-start: 22px;
}

li {
  margin-bottom: 6px;
}

.updated {
  margin-top: 6px;
  color: var(--text-3);
  font-size: 13.5px;
}

.summary {
  margin: 24px 0 8px;
  padding: 16px 20px;
  border-radius: 12px;
  background: var(--brand-tint);
}

.summary p {
  margin-bottom: 6px;
  font-weight: 600;
}

.summary ul {
  margin: 0;
}

/* Above a translated policy, pointing to the English one. */
.translation {
  margin-bottom: 24px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-2);
  font-size: 13.5px;
}

/* Links with the copyright under them in the middle, language at the end. */
.foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas: ". middle langs";
  align-items: center;
  gap: 16px;
  max-width: var(--page);
  margin: 0 auto;
  padding: 24px 16px 40px;
  color: var(--text-3);
  font-size: 13px;
}

.foot-middle {
  grid-area: middle;
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
}

.foot .foot-copy {
  margin: 0;
}

.foot > .langs {
  grid-area: langs;
  justify-self: end;
}

.foot a {
  color: var(--text-2);
}

/* The language menu: links to this page in every language, in a list that opens above. */
.langs {
  position: relative;
  display: inline-block;
}

.langs summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding-inline: 12px 10px;
  border: 1px solid #d2d0c6;
  border-radius: 999px;
  color: var(--text-2);
  cursor: pointer;
  list-style: none;
  -webkit-user-select: none;
  user-select: none;
  transition: background-color 0.15s, border-color 0.15s;
}

.langs summary::-webkit-details-marker {
  display: none;
}

.langs summary:hover,
.langs[open] summary {
  background: var(--surface);
  border-color: var(--text-3);
}

.langs-chevron {
  transition: transform 0.15s;
}

.langs[open] .langs-chevron {
  transform: rotate(180deg);
}

.langs-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  inset-inline-end: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 2px;
  margin: 0;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 44px -18px rgba(20, 20, 19, 0.32);
  list-style: none;
  text-align: start;
}

.langs-menu li {
  margin: 0;
}

.foot .langs-menu a {
  display: block;
  padding: 7px 14px;
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}

.langs-menu a:hover {
  background: var(--bg);
}

.foot .langs-menu a[aria-current="page"] {
  color: var(--brand);
  font-weight: 600;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ------------------------------------------------------------------ contact */

.contact {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: start;
  gap: 56px;
  max-width: var(--page);
  margin: 0 auto;
  padding: 40px 16px 24px;
}

.contact-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(38px, 5vw, 56px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.contact-intro > p {
  margin-top: 20px;
  color: var(--text-2);
  font-size: 17px;
}

.contact-card,
.sent {
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow:
    0 1px 1px rgba(20, 20, 19, 0.03),
    0 24px 48px -32px rgba(20, 20, 19, 0.25);
}

.contact-card {
  display: grid;
  gap: 18px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span {
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #d2d0c6;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field ::placeholder {
  color: #a3a29b;
  opacity: 1;
}

.field textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.55;
}

.field select {
  padding-inline-end: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236f6e69' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 14px center;
  background-repeat: no-repeat;
  -webkit-appearance: none;
  appearance: none;
}

[dir="rtl"] .field select {
  background-position: left 14px center;
}

/* Email addresses read left to right on right-to-left pages too. */
[dir="rtl"] .field input[type="email"] {
  text-align: right;
}

.field :focus {
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 80, 46, 0.14);
}

.field :user-invalid {
  border-color: #c4472f;
}

/* Bots fill in every field; people never see this one. */
.honey {
  /* Hidden where it stands: pushing it off to one side would make right-to-left pages
     scroll sideways into an empty strip. */
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  opacity: 0;
  pointer-events: none;
}

.send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  justify-self: start;
  height: 50px;
  padding: 0 22px 0 26px;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-size: 15.5px;
  font-weight: 500;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 10px 24px -12px rgba(0, 80, 46, 0.7);
  transition: background-color 0.15s;
}

.send:hover {
  background: #00653a;
}

.send:disabled {
  cursor: progress;
  opacity: 0.7;
}

.send svg {
  transition: transform 0.2s;
}

.send:hover:not(:disabled) svg {
  transform: translateX(3px);
}

/* Right-to-left pages: the arrow points (and moves) the other way. */
[dir="rtl"] .send svg {
  scale: -1 1;
}

.form-error {
  margin: 0;
  padding: 11px 14px;
  border-radius: 12px;
  background: #fbecec;
  color: #a32626;
  font-size: 14px;
}

.form-note {
  margin: 0;
  color: var(--text-3);
  font-size: 12.5px;
}

/* Shown instead of the form once a message is sent (or after FormSubmit's redirect to #sent). */
.sent {
  display: none;
  justify-items: start;
  gap: 10px;
}

.sent:focus {
  outline: none;
}

.sent svg {
  color: var(--brand);
}

.sent h2 {
  margin: 6px 0 0;
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.sent p {
  margin: 0;
  color: var(--text-2);
}

.contact.is-sent .contact-card,
.contact:has(.sent:target) .contact-card {
  display: none;
}

.contact.is-sent .sent,
.sent:target {
  display: grid;
}

/* ------------------------------------------------------------------ log in */

/* No footer here: the card sits in the middle of what's left under the top bar. */
.login {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 110px);
  min-height: calc(100dvh - 110px);
  padding: 24px 16px 40px;
}

.login-card {
  display: grid;
  justify-items: center;
  gap: 20px;
  width: 100%;
  max-width: 420px;
  padding: 36px 32px 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow:
    0 1px 1px rgba(20, 20, 19, 0.03),
    0 24px 48px -32px rgba(20, 20, 19, 0.25);
  text-align: center;
}

.login-logo {
  display: block;
}

.login-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.login-sub {
  margin: 8px 0 0;
  color: var(--text-2);
}

.login .form-error {
  width: 100%;
}

/* Google's own button style: white, its "G", a light outline. */
.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 48px;
  border: 1px solid #d2d0c6;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s;
}

.google-btn:hover {
  background: var(--bg);
  border-color: var(--text-3);
}

.login-note {
  margin: 0;
  color: var(--text-3);
  font-size: 13px;
  line-height: 1.55;
}

.login-note a {
  color: var(--text-2);
}

html:is(:lang(ar), :lang(fa), :lang(hi), :lang(zh), :lang(ja), :lang(ko)) .login-title {
  letter-spacing: 0;
}

@media (max-width: 640px) {
  .login-card {
    padding: 28px 20px 24px;
  }
}

/* ------------------------------------------------------------------ 404 */

.missing {
  display: grid;
  justify-items: start;
  gap: 14px;
  max-width: var(--page);
  margin: 0 auto;
  padding: 72px 16px 96px;
}

.missing p {
  margin: 0;
  color: var(--text-2);
  font-size: 17px;
}

.missing .missing-code {
  color: var(--brand);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.missing .open {
  display: inline-block;
  margin-top: 12px;
}

@media (max-width: 860px) {
  .contact {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
    padding-top: 24px;
  }
}

@media (max-width: 640px) {
  /* The menu moves to a row of its own under the logo and "Log in". */
  .nav {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand end"
      "links links";
    row-gap: 4px;
    height: auto;
    padding: 8px 8px 6px 14px;
    border-radius: 24px;
  }

  .top {
    top: 8px;
    margin-top: 8px;
  }

  .nav-links a {
    padding: 6px 12px;
    font-size: 14px;
  }

  .contact-card,
  .sent {
    padding: 22px 18px;
    border-radius: 14px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .send {
    justify-self: stretch;
  }

  .doc {
    margin: 0 16px;
    padding: 24px 20px 28px;
    border-radius: 14px;
  }

  h1 {
    font-size: 25px;
  }

  /* Phones: links, copyright and language stacked in the middle. */
  .foot {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "middle"
      "langs";
  }

  .foot > .langs {
    justify-self: center;
  }

  .langs-menu {
    grid-template-columns: repeat(2, auto);
    inset-inline-end: auto;
    left: 50%;
    translate: -50% 0;
  }
}
