/* Grid2Icons shared design system */
* { box-sizing: border-box; }

:root {
  /* Colors */
  --header-bg: #201C1B;
  --accent: #E5A152;
  --page-bg: #f5f2ee;
  --card-bg: #fff;
  --text-primary: #1a1a1a;
  --text-secondary: #333;
  --text-muted: #555;
  --text-hint: #666;
  --text-subtle: #777;
  --border: #ccc;
  --border-light: #ddd;
  --border-input: #888;
  --input-bg: #f8f8f8;
  --btn-primary-bg: #333;
  --btn-primary-hover: #555;
  --focus-ring: var(--accent);
  --error: #c00;
  --success: #0a0;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "Cascadia Code", "Source Code Pro", monospace;
  --text-base: 0.95rem;
  --text-sm: 0.9rem;
  --text-xs: 0.85rem;
  --heading-lg: 1.75rem;
  --heading-md: 1rem;

  /* Spacing */
  --section-gap: 1.5rem;
  --card-padding: 1.5rem;
  --input-padding: 0.5rem 0.6rem;
  --btn-padding: 0.6rem 1.2rem;
  --radius-input: 6px;
  --radius-card: 12px;
  --content-max: min(720px, 92vw);
}

/* App header: full-width dark bar */
.app-header {
  background: var(--header-bg);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.app-header__inner {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.app-header__logo {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: baseline;
}

.app-header__logo-num {
  font-size: 1.85em;
  line-height: 1;
  vertical-align: middle;
  margin: 0 0.02em;
}

.app-header__logo:hover {
  color: #f0b86a;
}

.app-header__logo:hover .app-header__logo-num {
  color: inherit;
}

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

.app-header__nav {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.app-header__nav:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.6);
  color: #fff;
}

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

/* Auth block in header */
.app-header__auth {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.auth-loading,
.auth-guest,
.auth-user {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.9);
}

.auth-user {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.app-header__auth-btn {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.app-header__auth-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.6);
}

.app-header__auth-btn:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app-header__auth-sep {
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0.15rem;
}

#auth-user-email {
  font-weight: 500;
}

/* Profile dropdown (when signed in) */
.profile-dropdown {
  position: relative;
  display: flex;
  align-items: center;
}

.profile-dropdown__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
}

.profile-dropdown__initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5em;
  height: 1.5em;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.5);
  font-size: 0.85em;
  font-weight: 600;
  line-height: 1;
  flex-shrink: 0;
}

.profile-dropdown__chevron {
  font-size: 0.65em;
  opacity: 0.8;
}

.profile-dropdown__menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.35rem;
  min-width: 12rem;
  padding: 0.5rem 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 100;
}

.profile-dropdown__email {
  padding: 0.5rem 1rem;
  font-size: var(--text-sm);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
  word-break: break-all;
}

.profile-dropdown__link,
.profile-dropdown__btn {
  display: block;
  width: 100%;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  text-align: left;
  color: var(--text-primary);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.profile-dropdown__link:hover,
.profile-dropdown__btn:hover {
  background: var(--input-bg);
}

.profile-dropdown__link:focus,
.profile-dropdown__btn:focus {
  outline: none;
  background: var(--input-bg);
  box-shadow: inset 0 0 0 2px var(--focus-ring);
}

/* Main content wrapper: same max-width as header inner */
.main-content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 2rem 1.5rem;
  min-height: 50vh;
}

/* Step badge for section headers */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--header-bg);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  flex-shrink: 0;
}

.section-title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.section-title-row .section-title {
  font-size: var(--heading-md);
  font-weight: 700;
  color: var(--text-secondary);
  margin: 0;
}

/* Primary button (accent) */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
}

.btn-primary:hover {
  background: #d49248;
  color: #fff;
}

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

/* Focus visible for keyboard users */
input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
