/* front.css: the front page only, which is also where the family signs in. One screen,
 * no scrolling, down to a small phone: the type scales with the height of the window as
 * well as its width, and on short windows the page drops what it can spare, never the
 * button. Below about 320 x 480 it is allowed to scroll rather than clip.
 * Everything is scoped under .front; the books never load this file. */

.front { margin: 0; }
.front-page { min-height: 100vh; min-height: 100svh; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); }

/* ---------- The words ---------- */
.front-text {
  --gap: clamp(.7rem, 2.4svh, 1.5rem);
  display: flex; flex-direction: column; justify-content: center; gap: var(--gap);
  padding: clamp(1rem, 3.4svh, 2.4rem) clamp(1.1rem, 4.5vw, 4.5rem);
  font-size: clamp(.94rem, min(1.2vw + .55rem, 2.25svh), 1.08rem); line-height: 1.5;
}
.front-text p { margin: 0; }
.front-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.front .kicker { font-family: var(--head); font-style: italic; font-size: clamp(1.02rem, 2.4svh, 1.2rem); line-height: 1.25; color: var(--red); text-wrap: balance; }
.front .theme { flex: none; }

.front-name { display: flex; align-items: center; gap: clamp(.6rem, 1.4vw, 1rem); }
.front-name img { flex: none; width: clamp(3.2rem, 10svh, 5.25rem); height: auto; }
.front-name img { margin-left: -.55rem; margin-right: -.3rem; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .front-name img { margin: 0; } }
:root[data-theme="dark"] .front-name img { margin: 0; }
.front h1 { margin: 0; font-size: clamp(1.85rem, min(4.2vw, 7.4svh), 3.5rem); line-height: 1.04; }
.front h1 span { color: var(--red); }

.front-story { display: flex; flex-direction: column; gap: .6em; color: var(--ink-2); max-width: 62ch; }

/* ---------- The door ---------- */
.front-door { padding: var(--gap) 0 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: flex-start; gap: .75em; max-width: 62ch; }
.front-door p { color: var(--ink-2); }
.front-door h2 { margin: 0; font-size: clamp(1.3rem, 3.2svh, 1.65rem); line-height: 1.15; }

/* The site's own button: this is the family's door, even though Google checks who you are behind it. */
.door-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 3rem; padding: .2rem 1.7rem;
  border: 0; border-radius: var(--radius); background: var(--red); color: var(--paper);
  font-family: var(--head); font-weight: 600; font-size: 1.4rem; line-height: 1; letter-spacing: .01em;
  text-decoration: none; white-space: nowrap; cursor: pointer; transition: background-color .15s ease;
}
.door-btn:hover, .door-btn:focus-visible { background: var(--red-2); color: var(--paper); }
.door-btn:active { transform: translateY(1px); }

.front-help { color: var(--ink-2); font-size: .94em; }
.front-credit { color: var(--ink-3); font-size: .82em; line-height: 1.35; }

/* ---------- The picture ---------- */
.front-photo { margin: 0; min-height: 0; position: relative; background: var(--paper-3); }
.front-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 62%; display: block; }

/* ---------- Tighter two-column windows: small laptops, or a lot of browser around them ---------- */
@media (max-height: 50em), (max-width: 72em) { .front-spellings { display: none; } }
@media (max-height: 36em) { .front-text > .front-credit { display: none; } }

/* ---------- Upright phones and tablets: the picture becomes a band across the top ---------- */
@media (max-width: 52em) and (min-height: 30.01em), (max-width: 52em) and (orientation: portrait) {
  .front-page { position: relative; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(4.5rem, 1fr) auto; } /* the picture takes whatever the words leave */
  .front-photo { grid-row: 1; }
  .front-text { grid-row: 2; justify-content: flex-start; --gap: clamp(.55rem, 1.7svh, 1.3rem); padding-block: clamp(.7rem, 1.9svh, 1.6rem); font-size: clamp(.9rem, 2.05svh, 1.06rem); line-height: 1.42; }
  .front h1 { font-size: clamp(1.7rem, min(8.4vw, 5svh), 3rem); }
  .front-name img { width: clamp(2.5rem, 7svh, 4rem); }
  /* On the picture, so it does not cost a row. */
  .front .theme { position: absolute; top: .6rem; right: .6rem; z-index: 1; }
}
/* Phones up to about the iPhone 14's visible height: give up the credit and the sub-heading. */
@media (max-width: 52em) and (max-height: 44em) {
  .front-page { grid-template-rows: minmax(3.4rem, 1fr) auto; }
  .front-text > .front-credit, .front-door h2 { display: none; }
  .front-door { gap: .6em; }
}
/* The smallest phones: the route too. The story and the button stay. */
@media (max-width: 52em) and (max-height: 38em) { .front .kicker { display: none; } .front-top { display: contents; } }

/* ---------- Phones held sideways: two columns again, most of the width for the words ---------- */
@media (max-height: 30em) and (orientation: landscape) {
  .front-page { position: relative; grid-template-columns: minmax(0, 1.9fr) minmax(0, .6fr); }
  .front-text { --gap: .45rem; padding-block: .5rem; font-size: .88rem; line-height: 1.34; }
  .front-text > .front-credit, .front-door h2, .front-name img, .front .kicker { display: none; }
  .front-top { display: contents; }
  .front .theme { position: absolute; top: .5rem; right: .5rem; z-index: 1; }
  .front h1 { font-size: 1.6rem; }
  .door-btn { min-height: 2.75rem; font-size: 1.25rem; }
  .front-door { flex-direction: row; flex-wrap: wrap; align-items: center; gap: .4rem .9rem; }
  .front-door > p:first-of-type { flex-basis: 100%; }
  .front-help { flex: 1 1 14rem; font-size: .9em; }
}
@media (max-height: 22em) and (orientation: landscape) { .front-door > p:first-of-type { display: none; } }

/* ---------- Ask for access: the overlay ---------- */
.ask {
  width: min(34rem, calc(100vw - 2rem)); max-height: calc(100svh - 2rem); overflow: auto;
  padding: clamp(1rem, 3svh, 2rem) clamp(1.1rem, 4vw, 2rem); border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); color: var(--ink); box-shadow: var(--shadow); line-height: 1.45;
}
.ask::backdrop { background: rgba(20, 26, 33, .6); }
.ask:focus-visible { outline: 0; } /* opened from a link, the dialog itself takes focus; the ring belongs on the fields */
.ask:target { display: block; position: fixed; inset: 1rem; margin: auto; height: fit-content; z-index: 10; } /* no JavaScript: the link still opens it */
.ask h2 { margin: 0 0 .3em; font-size: clamp(1.45rem, 4svh, 1.9rem); }
.ask p { margin: 0; color: var(--ink-2); font-size: .97rem; }
.ask label { display: block; margin-top: clamp(.5rem, 1.6svh, .9rem); font-weight: 600; font-size: .94rem; }
.ask input, .ask textarea {
  display: block; width: 100%; margin-top: .25rem; padding: .55rem .7rem; border: 1px solid var(--ink-3); border-radius: 2px;
  background: var(--paper); color: var(--ink); font: 400 1rem/1.35 var(--body); /* 16px: iOS zooms the page on anything smaller */
}
.ask input[type="hidden"] { display: none; } /* the rule above would otherwise draw the token's field */
.ask textarea { resize: vertical; min-height: 4.2rem; }
.ask-sum { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .8rem; }
.ask-sum input { width: 5rem; margin-top: 0; text-align: center; }
.ask-trap { position: absolute; left: -100vw; width: 1px; height: 1px; overflow: hidden; }
.ask-error { margin-top: .8rem !important; color: var(--red) !important; font-weight: 600; }
.ask-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.3rem; margin-top: clamp(.8rem, 2.2svh, 1.2rem); }
.ask-actions .door-btn { font-size: 1.25rem; min-height: 2.8rem; }
.ask-close:not(.door-btn) { color: var(--ink-2); }

/* The smallest phones: the overlay gives up its introduction first, so the fields stay on screen. */
@media (max-height: 38em) { .ask-form > p:first-of-type { display: none; } .ask textarea { min-height: 3.2rem; } }

/* What the form says when it has posted without JavaScript. */
.front-note { display: none; color: var(--red); font-weight: 600; }
.front-note:target { display: block; }

/* ---------- The door's own error page (door/error.html) ---------- */
.front-brand { display: flex; align-items: center; gap: .5rem; font-family: var(--head); font-weight: 600; font-size: 1.35rem; color: var(--ink); }
.front-brand img { flex: none; width: 3rem; height: auto; margin-left: -.4rem; }
.front-brand a { color: inherit; text-decoration: none; }
.front-brand span { color: var(--red); }
.front-denied h1 { font-size: clamp(1.8rem, min(3.6vw, 6.4svh), 3rem); line-height: 1.08; max-width: 18ch; }
.front-denied .front-door { border-top: 0; padding-top: 0; }
