/* xd-sync sign-in page. Same visual language as the Social Newsletter issue:
   a warm wash page, white cards with a hairline border and a 20px radius,
   display-serif headings over sans body text, and the vermilion signal for
   accents. The layout is its own — this is a sign-in page, not an issue. */

:root {
  --paper: #ffffff;
  --wash: #f6f5f2;
  --ink: #12141a;
  --muted: #6a6f7a;
  --line: #e4e2dd;
  --accent: #e8402a;
  --display: "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif;
  --gutter: clamp(20px, 5vw, 64px);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--wash);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  color: var(--ink);
  background: rgba(232, 64, 42, 0.16);
}

button {
  font: inherit;
}

.page {
  display: grid;
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(36px, 6vw, 64px) var(--gutter) 96px;
  gap: 18px;
}

.masthead {
  padding: 0 2px;
  margin-bottom: 6px;
}

.masthead-overline {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.masthead-title {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.02em;
}

.masthead-meta {
  margin: 14px 0 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.01em;
  line-height: 1.6;
}

.rule {
  height: 1px;
  background: var(--line);
}

/* One card language: the card supplies the surface, border and padding; the
   content inside never adds a second one. */
.card {
  padding: clamp(20px, 3.4vw, 30px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px 16px;
}

.card-title {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 1.7rem;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.card-head .card-title {
  margin-bottom: 0;
}

.card-note {
  margin: 0 0 18px;
  max-width: var(--measure, 68ch);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.fields {
  display: grid;
  gap: 14px;
}

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

.field-name {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.input {
  height: 38px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
}

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

.token-input {
  min-width: 0;
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.token-row {
  display: flex;
  gap: 8px;
}

.help {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}

.button {
  height: 38px;
  padding: 0 18px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease;
}

.button:hover:not(:disabled) {
  border-color: var(--ink);
}

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

.button:disabled {
  opacity: 0.55;
  cursor: default;
}

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

.button-primary:hover:not(:disabled) {
  color: #fff;
  background: #000;
  border-color: #000;
}

.button-danger {
  color: var(--accent);
}

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

.list {
  display: grid;
}

.list-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.list-item:first-child {
  border-top: 0;
  padding-top: 4px;
}

.item-name {
  font-weight: 600;
  font-size: 14px;
}

.item-name .this-device {
  color: var(--accent);
  font-weight: 600;
}

.item-meta {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  word-break: break-all;
}

.item-state {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.item-state.revoked {
  color: var(--accent);
}

.list-item .button {
  height: 30px;
  padding: 0 14px;
}

.code-result {
  margin-top: 14px;
}

.status {
  margin: 0;
  padding: 0 2px;
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.status.error {
  color: var(--accent);
}

.colophon {
  margin-top: 4px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

@media (max-width: 560px) {
  .card {
    padding: 22px 18px;
    border-radius: 16px;
  }

  .token-row {
    flex-wrap: wrap;
  }

  .token-input {
    flex-basis: 100%;
  }

  .brief-source {
    max-width: 100%;
  }
}

/* View tabs -------------------------------------------------------------- */

/* The signed-in page has two views: the account cards and the newsletter
   reader. The switch is the same pill shape the issue's window switch uses. */
.tabs {
  display: flex;
  width: fit-content;
  padding: 3px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.tab-button {
  padding: 6px 16px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}

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

.tab-button[aria-pressed="true"] {
  color: #fff;
  background: var(--ink);
}

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

/* Newsletter reader ------------------------------------------------------- */

/* The generated newsletter read, carried over from the extension's issue:
   sans against the page, a hero with kicker/title/standfirst/meta, topic
   sections, and numbered source chips. */
.brief-view {
  max-width: 62ch;
  margin: 6px 0 0;
  color: var(--ink);
}

.brief-hero {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.brief-kicker {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.brief-title {
  margin: 0;
  font-family: var(--sans);
  font-size: clamp(1.7rem, 4.5vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
}

.brief-standfirst {
  margin-top: 16px;
}

.brief-standfirst .brief-paragraph {
  margin: 0 0 10px;
  color: #3d424c;
  font-size: 1.08rem;
  line-height: 1.65;
}

.brief-meta {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.brief-section {
  margin-top: 32px;
}

.brief-view .brief-heading {
  font-weight: 650;
  letter-spacing: -0.02em;
}

.brief-section > .brief-heading {
  margin: 0 0 14px;
  font-size: 1.3rem;
  line-height: 1.2;
}

.brief-view .brief-heading:not(:first-child) {
  margin: 28px 0 10px;
  font-size: 1.05rem;
}

.brief-paragraph {
  margin: 0 0 14px;
  font-size: 0.95rem;
  line-height: 1.7;
}

.brief-view code {
  padding: 1px 5px;
  background: var(--wash);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
}

.brief-list {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.brief-list li {
  position: relative;
  margin: 0 0 12px;
  padding-left: 20px;
  font-size: 0.95rem;
  line-height: 1.65;
}

.brief-list li::before {
  position: absolute;
  top: 0.55em;
  left: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.brief-list strong {
  font-weight: 650;
}

.brief-quote {
  margin: 0 0 16px;
  padding: 4px 0 4px 18px;
  color: #3d424c;
  border-left: 2px solid var(--accent);
  font-size: 0.97rem;
  line-height: 1.65;
}

.brief-code {
  margin: 0 0 16px;
  padding: 12px 14px;
  overflow-x: auto;
  background: var(--wash);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
}

.brief-sources {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.brief-sources-title {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brief-source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.brief-source {
  display: flex;
  padding: 8px 13px 8px 8px;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  text-decoration: none;
}

a.brief-source:hover {
  border-color: var(--ink);
}

.brief-source-number {
  display: inline-flex;
  flex: none;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--ink);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* The record-derived thumbnail: the number badge's size, square with the
   code radius, covered so any media aspect fits the chip row. Decorative
   (alt=""), so it carries no text styling of its own. */
.brief-source-thumb {
  flex: none;
  width: 22px;
  height: 22px;
  object-fit: cover;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.brief-source-text {
  display: grid;
  min-width: 0;
}

.brief-source-title {
  overflow: hidden;
  max-width: 34ch;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brief-source-byline {
  color: var(--muted);
  font-size: 11px;
}

/* Past newsletters index: the same row language as the issue's card — the
   generated date, then what the newsletter was written from. */
.past-wrap {
  margin-top: 28px;
}

.past-heading {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.past-list {
  display: grid;
  max-height: 300px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.past-item {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--line);
}

.past-item:first-child {
  border-top: 0;
}

.past-open {
  display: grid;
  flex: 1;
  padding: 10px 10px;
  gap: 2px;
  color: var(--ink);
  background: none;
  border: 0;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
}

.past-open:hover {
  background: var(--wash);
}

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

.past-open[aria-current="true"] {
  background: var(--wash);
}

.past-when {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.past-meta {
  color: var(--muted);
  font-size: 12px;
}
