/* Essential Mail docs. Colors, radii and type follow the app: iOS grouped backgrounds, Essential's
   blue (#4D9DEB), the system font, cards with 22px corners. */

:root {
  color-scheme: light;
  --bg: #f2f2f7;
  --surface: #ffffff;
  --bar: rgba(242, 242, 247, 0.8);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --separator: rgba(60, 60, 67, 0.16);
  --fill: rgba(118, 118, 128, 0.12);
  --hover: rgba(118, 118, 128, 0.08);
  --selected: rgba(77, 157, 235, 0.16);
  --thumb: #ffffff;
  --thumb-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.04);
  --link: #1a6dbf;
  --brand: #4d9deb;
  /* Essential's blue, deepened where white text sits on it (4.9:1). */
  --button: #1f72c4;

  --radius-card: 22px;
  --bar-height: 52px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000;
    --surface: #1c1c1e;
    --bar: rgba(0, 0, 0, 0.72);
    --text: #f5f5f7;
    --text-2: #98989d;
    --separator: rgba(84, 84, 88, 0.6);
    --fill: rgba(118, 118, 128, 0.24);
    --hover: rgba(118, 118, 128, 0.16);
    --selected: rgba(77, 157, 235, 0.24);
    --thumb: #636366;
    --thumb-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --link: #4d9deb;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #1c1c1e;
  --bar: rgba(0, 0, 0, 0.72);
  --text: #f5f5f7;
  --text-2: #98989d;
  --separator: rgba(84, 84, 88, 0.6);
  --fill: rgba(118, 118, 128, 0.24);
  --hover: rgba(118, 118, 128, 0.16);
  --selected: rgba(77, 157, 235, 0.24);
  --thumb: #636366;
  --thumb-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --link: #4d9deb;
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-height) + 16px); }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

.icon { width: 1em; height: 1em; fill: currentColor; flex: none; }

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 20;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--button);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 8px; }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, transparent); outline-offset: 2px; }

/* Top bar: a translucent navigation bar with the app's mark. */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--separator);
}

.topbar-inner {
  max-width: 1080px;
  height: var(--bar-height);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand img { width: 28px; height: 28px; }
.brand-sub { color: var(--text-2); font-weight: 400; }

.menu-button {
  display: none;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.menu-button:hover { background: var(--hover); }
.menu-button .close { display: none; }
.menu-button[aria-expanded="true"] .open { display: none; }
.menu-button[aria-expanded="true"] .close { display: block; }

/* Sidebar and page column. */

.layout {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 20px 48px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 56px;
}

.sidebar {
  position: sticky;
  top: calc(var(--bar-height) + 32px);
  align-self: start;
}

.nav-title {
  margin: 0 0 6px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.nav-list { list-style: none; margin: 0 0 24px; padding: 0; }

.nav-list a {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
}
.nav-list a:hover { background: var(--hover); }
.nav-list a[aria-current="page"] { background: var(--selected); font-weight: 600; }

.content { min-width: 0; max-width: 680px; }

/* Page header: the app's ScreenHeader, a large bold title with a secondary line under it. */
.page-header { margin-bottom: 28px; }
.page-header h1 {
  margin: 0 0 8px;
  font-size: clamp(30px, 5vw, 38px);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.022em;
}
.page-header p { margin: 0; color: var(--text-2); font-size: 19px; line-height: 1.45; }
.page-header .meta { margin-top: 12px; font-size: 13px; }

.hero-logo { display: block; width: 72px; height: 72px; margin-bottom: 20px; }

/* Cards: grouped sections with 22px corners. */
.card {
  margin: 0 0 16px;
  padding: 20px 22px;
  background: var(--surface);
  border-radius: var(--radius-card);
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card h2 { margin: 0 0 8px; font-size: 20px; line-height: 1.3; font-weight: 600; letter-spacing: -0.012em; }
.card h3 { margin: 18px 0 4px; font-size: 17px; font-weight: 600; }
.card p { margin: 0 0 12px; }
.card ul { margin: 0 0 12px; padding-left: 1.25em; }
.card li + li { margin-top: 6px; }
.card li::marker { color: var(--text-2); }

.content a:not(.button):not(.row) {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link) 35%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.content a:not(.button):not(.row):hover { text-decoration-color: currentColor; }

.section-title { margin: 28px 0 8px; padding: 0 18px; font-size: 13px; font-weight: 600; color: var(--text-2); }

/* Grouped list: rows with inset separators, like the app's lists. */
.list { list-style: none; margin: 0 0 16px; padding: 0; background: var(--surface); border-radius: var(--radius-card); overflow: hidden; }
.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 12px 18px 12px 20px;
  color: var(--text);
  text-decoration: none;
}
.row:hover { background: var(--hover); }
.list li + li .row::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 20px;
  border-top: 0.5px solid var(--separator);
}
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 600; }
.row-detail { color: var(--text-2); font-size: 15px; }
.row .chevron { color: var(--text-2); font-size: 13px; opacity: 0.7; }

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  background: var(--button);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.button:hover { filter: brightness(1.08); }

/* Footer, with the appearance control. */

.footer { border-top: 0.5px solid var(--separator); }
.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 20px 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  color: var(--text-2);
}
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.footer a { color: var(--text-2); text-decoration: none; }
.footer a:hover { color: var(--text); }

/* Segmented control. Without JavaScript it couldn't do anything, so it only shows with it. */
.segmented { display: none; margin: 0; padding: 2px; border: 0; border-radius: 999px; background: var(--fill); }
.js .segmented { display: inline-flex; }
.segmented legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.segmented label {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s;
}
.segmented input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.segmented label:has(input:checked) { background: var(--thumb); box-shadow: var(--thumb-shadow); }
.segmented label:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--brand) 60%, transparent); outline-offset: 1px; }

@media (max-width: 860px) {
  .menu-button { display: inline-flex; }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 24px; }
  .sidebar { position: static; }
  .js .sidebar { display: none; }
  .js .sidebar.open { display: block; padding-bottom: 8px; }
  .content { max-width: none; }
}

@media (max-width: 480px) {
  .topbar-inner { padding: 0 16px; }
  .layout { padding: 20px 16px 40px; }
  .card { padding: 18px; }
  .footer-inner { padding: 20px 16px 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .segmented label { transition: none; }
}
