/* GCal Sync — International Typographic Style
   Grid-driven, flush-left, one accent color, zero decoration beyond hairline rules.
   Spacing and type derive from the small scales below — avoid one-off values;
   round to the nearest step instead. */

/* Archivo is downloaded and bundled with the application so visitors' browsers do
   not contact an external font provider. See the privacy policy and fonts/README.md. */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 900;
  font-stretch: 100%;
  font-display: swap;
  src: url("../fonts/archivo-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 900;
  font-stretch: 100%;
  font-display: swap;
  src: url("../fonts/archivo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #ffffff;
  --ink: #000000;
  --accent: #d6001c;
  --rule: #d8d8d3;
  --muted: #6e6e68;

  /* Spacing scale (rem): every padding/margin/gap below is one of these. */
  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.25rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;

  /* Type scale: five sizes, weight/family carry hierarchy at equal sizes
     (e.g. .lead vs h2) rather than adding more steps. */
  --fs-label: 0.75rem;
  --fs-small: 0.875rem;
  --fs-body: 1rem;
  --fs-h2: 1.25rem;
  --fs-h1: 1.75rem;
  --fs-display: clamp(2.75rem, 7vw, 5rem);

  --gutter: clamp(1.5rem, 6vw, 4rem);
  --content-width: clamp(44rem, 58vw, 64rem);
  --col-label: 10rem;
  --col-aside: 16rem;
}

/* Breakpoint scale — custom properties can't be used inside @media conditions,
   so these are documented here instead of tokenized: collapsing progressively
   more columns down to a single-column mobile layout.
     640px  — field-row: label + control collapses to stacked
     860px  — pair-body: controls + preview collapses to stacked
     1024px — content-column boundary rule appears (enough margin to show it) */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
}

body {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: "Archivo", -apple-system, "Segoe UI", sans-serif;
  font-size: var(--fs-body);
  line-height: 1.55;
}

/* Marks the boundary between the live content column and the margin field,
   so the asymmetric whitespace reads as bounded structure, not leftover space. */
@media (min-width: 1024px) {
  body::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--content-width);
    width: 1px;
    background: var(--rule);
    pointer-events: none;
  }
}

h1, h2, h3, .wordmark {
  font-family: "Archivo", sans-serif;
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-2);
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); margin-top: 0; }

p { margin: 0 0 var(--space-3); max-width: 38rem; }

a { color: var(--ink); }
a:hover { color: var(--accent); }

.muted { color: var(--muted); }
.small { font-size: var(--fs-small); }
.num { font-variant-numeric: tabular-nums; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Nav / footer */

.site-nav {
  border-bottom: 1px solid var(--rule);
  padding: var(--space-4) var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: "Archivo", sans-serif;
  font-weight: 900;
  font-size: var(--fs-body);
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--ink);
}

.brand:hover { color: var(--ink); }

.brand-mark {
  display: block;
  width: 1.75rem;
  height: 1.75rem;
  flex: none;
}

.page {
  flex-grow: 1;
  width: 100%;
  max-width: var(--content-width);
  padding: var(--space-7) var(--gutter);
}

.site-footer {
  border-top: 1px solid var(--rule);
  padding: var(--space-4) var(--gutter);
  margin-top: auto;
}

.site-footer a {
  color: var(--muted);
  font-size: var(--fs-small);
  text-decoration: none;
}

.site-footer a:hover { color: var(--accent); }

/* Hero / landing */

.hero { margin: var(--space-1) 0 var(--space-6); }

.wordmark {
  font-size: var(--fs-display);
  letter-spacing: -0.02em;
  margin: 0;
}

.keyline {
  width: 4rem;
  height: 4px;
  background: var(--accent);
  margin: var(--space-4) 0 var(--space-5);
}

.lead {
  font-size: var(--fs-h2);
  max-width: 34rem;
}

.prose p { color: var(--ink); }

/* Buttons */

.btn {
  display: inline-block;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  padding: var(--space-2) var(--space-4);
  font: inherit;
  font-weight: 700;
  font-size: var(--fs-small);
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn:hover { background: var(--ink); color: var(--paper); }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--ink); border-color: var(--ink); }

.btn-danger { border-color: var(--accent); color: var(--accent); }
.btn-danger:hover { background: var(--accent); color: #fff; }

.btn-sm {
  min-height: 2.75rem;
  padding: var(--space-1) var(--space-2);
}

/* Forms */

input[type="text"],
input[type="number"],
select {
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  padding: var(--space-1) var(--space-2);
  font: inherit;
  font-size: var(--fs-body);
}

label { font-size: var(--fs-small); color: var(--muted); }

.inline-form {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
  align-items: center;
  margin-top: var(--space-1);
}

.stack-sm {
  display: block;
  width: 100%;
  margin-top: var(--space-1);
}

/* Alerts */

.alert {
  border-left: 3px solid var(--ink);
  padding: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-4);
  font-size: var(--fs-small);
  max-width: 38rem;
}

.alert-danger { border-color: var(--accent); color: var(--accent); }
.alert-warning { border-color: var(--ink); color: var(--ink); }
.alert-success { border-color: var(--ink); color: var(--ink); }

/* Row list (dashboard) */

.rowlist { margin: var(--space-5) 0; }

.rowlist-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--rule);
}

.rowlist-item:first-child { border-top: 1px solid var(--rule); }

/* Flex items default to min-width: auto, which blocks shrinking below the
   intrinsic width of unbroken content (e.g. a long email) and causes the
   sibling action to be pushed off-screen instead of wrapping. */
.rowlist-item > div { min-width: 0; overflow-wrap: break-word; }

.rowlist-action {
  flex-shrink: 0;
  font-size: var(--fs-small);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.actions-row {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-5);
}

/* Field rows (calendar settings) */

.field-row {
  display: grid;
  grid-template-columns: var(--col-label) 1fr;
  gap: var(--space-1) var(--space-6);
  padding: var(--space-5) 0;
  border-bottom: 1px solid var(--rule);
}

.field-row:first-of-type { border-top: 1px solid var(--rule); }

.field-label {
  text-transform: uppercase;
  font-size: var(--fs-label);
  letter-spacing: 0.08em;
  font-weight: 700;
  /* Optical nudge to align the label's cap-height with the input box beside it. */
  padding-top: 0.2rem;
}

@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; gap: var(--space-1); }
}

.sync-help { max-width: 38rem; }

.sync-help details { margin-top: var(--space-1); }

.sync-help summary {
  width: fit-content;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--fs-small);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.sync-help summary:hover { color: var(--accent); }

.sync-help details[open] summary { margin-bottom: var(--space-1); }

/* Incoming connection pairs */

.pair {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--rule);
}

.pair-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.pair-actions { display: flex; gap: var(--space-1); flex-wrap: wrap; }

.pair-header > div:first-child { min-width: 0; overflow-wrap: break-word; }

.pair-status { font-weight: 700; }

.pair-body {
  display: grid;
  grid-template-columns: 1fr var(--col-aside);
  gap: var(--space-5) var(--space-6);
  margin-top: var(--space-3);
}

@media (max-width: 860px) {
  .pair-body { grid-template-columns: 1fr; }
}

.preview {
  border: 1px solid var(--rule);
  padding: var(--space-3);
}

.preview-label {
  text-transform: uppercase;
  font-size: var(--fs-label);
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.preview-chip {
  border-left: 3px solid var(--ink);
  padding: var(--space-1) var(--space-2);
}

.preview-chip-title { font-weight: 700; font-size: var(--fs-small); }

.preview-chip-desc {
  color: var(--muted);
  font-size: var(--fs-small);
  margin-top: var(--space-1);
  white-space: pre-line;
}

/* Utility spacing */

.mt-1 { margin-top: var(--space-2); }
.mt-2 { margin-top: var(--space-5); }
.mt-3 { margin-top: var(--space-7); }
.mb-0 { margin-bottom: 0; }
