/* terezakrizova.com: an annotated contract */

:root {
  --font-body: 'Source Serif 4', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --paper: #FAFAF7;
  --paper-2: #F2F1EC;
  --ink: #16181D;
  --ink-soft: #50535A;
  --rule: #D9D7CF;
  --red: #B3261E;

  --gap-s: 1.5rem;
  --gap-m: 3rem;
  --gap-l: clamp(4rem, 8vw, 8rem);
  --ease: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.15rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { color: var(--red); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

.skip { position: absolute; left: 1rem; top: -4rem; background: var(--ink); color: var(--paper); padding: .6rem 1rem; z-index: 10; text-decoration: none; }
.skip:focus { top: 1rem; }

/* ---------- The contract grid: number | text | margin ---------- */

.sheet { max-width: 76rem; margin: 0 auto; padding: 0 1rem; }

.clause {
  display: grid;
  grid-template-columns: 5rem minmax(0, 40rem) minmax(0, 15rem);
  column-gap: 2.5rem;
  grid-auto-flow: row dense;
  padding: var(--gap-l) 0 0;
  scroll-margin-top: 1rem;
}
.clause > * { grid-column: 2; }
.clause .num {
  grid-column: 1;
  grid-row: 1 / span 20;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  padding-top: .55rem;
  border-top: 1px solid var(--ink);
  align-self: start;
}
.clause .note { grid-column: 3; }

.clause h2 {
  margin: 0 0 var(--gap-s);
  padding-top: .2rem;
  border-top: 1px solid var(--ink);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.02em;
}

.clause p { margin: 0 0 var(--gap-s); max-width: 62ch; }

/* margin annotations */
.note {
  font-family: var(--font-mono);
  font-size: .82rem;
  line-height: 1.45;
  color: var(--red);
  border-left: 2px solid var(--red);
  padding: .1rem 0 .1rem .75rem;
  margin: 0 0 var(--gap-s);
  align-self: start;
}

/* the reviewer's red underline */
.u {
  background: linear-gradient(var(--red), var(--red)) left 100% / 100% 2px no-repeat;
  color: inherit;
  padding-bottom: .06em;
}

/* ---------- Title block ---------- */

.title-block { padding-top: clamp(3rem, 7vw, 6rem); }
.title-block .num { border-top: 0; color: var(--red); font-size: 2.4rem; line-height: 1; padding-top: 0; }
.title-block .doc {
  font-family: var(--font-mono);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-soft);
  margin: 0 0 1.25rem;
}
.title-block h1 {
  margin: 0;
  font-size: clamp(3.4rem, 10vw, 7.5rem);
  font-weight: 600;
  line-height: .95;
  letter-spacing: -.035em;
}
.hereinafter { font-style: italic; font-size: 1.3rem; color: var(--ink-soft); margin: 1.25rem 0 var(--gap-m) !important; }
.lead { font-size: clamp(1.45rem, 2.6vw, 1.9rem); line-height: 1.35; letter-spacing: -.01em; margin-bottom: var(--gap-m) !important; }
.title-block .note { grid-row: 4; margin-top: .55rem; }

@media (prefers-reduced-motion: no-preference) {
  .title-block .u { animation: strike 700ms var(--ease) 300ms both; }
  .title-block .note { animation: annotate 600ms var(--ease) 800ms both; }
}
@keyframes strike { from { background-size: 0 2px; } to { background-size: 100% 2px; } }
@keyframes annotate { from { transform: translateX(-.6rem); clip-path: inset(0 100% 0 0); } to { transform: none; clip-path: inset(0 0 0 0); } }

.actions { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: .6rem 1.6rem;
  font-family: var(--font-mono); font-size: .9rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; text-decoration: none;
  color: var(--paper); background: var(--ink); border: 1px solid var(--ink); border-radius: 0; cursor: pointer;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
.button:hover { background: var(--paper); color: var(--ink); }

.langs { display: flex; gap: .25rem; align-items: center; font-family: var(--font-mono); font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; }
.langs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .45rem; text-decoration: none; color: var(--ink-soft); }
.langs a:hover { color: var(--red); }
.langs a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 2px; }

/* ---------- Exhibit A (portrait) ---------- */

.exhibit {
  grid-column: 3 !important;
  grid-row: 2 / span 4;
  margin: 0;
  align-self: start;
}
.exhibit img { display: block; width: 100%; height: auto; border: 1px solid var(--ink); }
.exhibit figcaption { font-family: var(--font-mono); font-size: .78rem; color: var(--ink-soft); margin-top: .5rem; }

/* ---------- Numbered sub-clauses ---------- */

.sub { list-style: none; margin: 0 0 var(--gap-s); padding: 0; counter-reset: sub; }
.sub li {
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  column-gap: .5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
}
.sub li:first-child { border-top: 1px solid var(--rule); }
.sub .n { font-family: var(--font-mono); font-size: .9rem; color: var(--ink-soft); padding-top: .2rem; }
.sub strong { display: block; font-weight: 600; }
.sub span.d { display: block; color: var(--ink-soft); font-size: 1.02rem; margin-top: .15rem; }
.sub .when { display: block; font-family: var(--font-mono); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin-top: .25rem; }

.clause h3 {
  font-family: var(--font-mono); font-size: .9rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .08em;
  margin: var(--gap-m) 0 .75rem;
}

/* ---------- Notices (form) ---------- */

.field { margin-bottom: 1.1rem; }
.field label { display: block; font-family: var(--font-mono); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: .3rem; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: .6rem .75rem;
  font: inherit; font-size: 1.05rem; color: var(--ink);
  background: #FFFFFE; border: 1px solid var(--ink); border-radius: 0;
}
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2.5rem; }
.field textarea { resize: vertical; min-height: 8rem; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--red); outline-offset: 0; }
.consent { display: flex; gap: .6rem; align-items: flex-start; font-size: 1rem; line-height: 1.45; margin: 1.2rem 0; }
.consent input { width: 20px; height: 20px; margin-top: .15rem; flex-shrink: 0; accent-color: var(--red); }
.sent { display: none; margin-top: var(--gap-s); padding-left: .75rem; border-left: 2px solid var(--red); font-family: var(--font-mono); font-size: .9rem; color: var(--red); }
.sent.is-visible { display: block; }

/* ---------- Signature footer ---------- */

.site-footer { margin-top: var(--gap-l); padding: var(--gap-m) 0; background: var(--paper-2); border-top: 1px solid var(--ink); }
.site-footer .clause { padding: 0; }
.signature { display: flex; flex-wrap: wrap; gap: 2rem 4rem; margin-bottom: var(--gap-m); }
.signature div { min-width: 14rem; }
.signature .line { font-style: italic; font-size: 1.7rem; letter-spacing: -.01em; border-bottom: 1px solid var(--ink); padding-bottom: .2rem; }
.signature .cap { font-family: var(--font-mono); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); margin-top: .4rem; }
.site-footer p { margin: 0 0 .6rem; font-size: .95rem; color: var(--ink-soft); max-width: 62ch; }
.site-footer a { display: inline-flex; align-items: center; min-height: 44px; }
.site-footer .langs { margin-bottom: .6rem; }

/* ---------- Plain pages ---------- */

.plain .back { display: inline-flex; align-items: center; min-height: 44px; font-family: var(--font-mono); font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; text-decoration: none; }
.plain .back:hover { text-decoration: underline; }
.plain h1 { margin: var(--gap-s) 0 .4rem; font-size: clamp(2.4rem, 6vw, 3.6rem); font-weight: 600; line-height: 1.05; letter-spacing: -.025em; }
.plain .updated { font-family: var(--font-mono); font-size: .85rem; color: var(--ink-soft); margin: 0 0 var(--gap-m); }
.plain h2 { font-size: 1.25rem; font-weight: 600; margin: var(--gap-s) 0 .4rem; border: 0; padding: 0; letter-spacing: 0; }
.plain .clause p { margin-bottom: 1rem; }
.notfound .big { font-family: var(--font-mono); font-size: clamp(4rem, 16vw, 8rem); line-height: 1; color: var(--red); margin: 0; }

/* ---------- Narrow screens: margin collapses into the text ---------- */

@media (max-width: 960px) {
  .clause { grid-template-columns: 4rem minmax(0, 1fr); column-gap: 1.25rem; }
  .clause .note, .exhibit { grid-column: 2 !important; grid-row: auto; }
  .exhibit { max-width: 15rem; margin-bottom: var(--gap-s); }
  .title-block .note { grid-row: auto; margin-top: 0; }
  .clause { grid-auto-flow: row; }
}
@media (max-width: 560px) {
  body { font-size: 1.08rem; }
  .clause { grid-template-columns: minmax(0, 1fr); }
  .clause > *, .clause .num, .clause .note, .exhibit { grid-column: 1 !important; grid-row: auto; }
  .clause .num { border-top: 0; padding-top: 0; margin-bottom: .4rem; color: var(--red); }
  .title-block .num { font-size: 1.6rem; }
  .button { width: 100%; }
  .sub li { grid-template-columns: 2.6rem 1fr; }
}
