/* Martin Wealth Solutions — app shell styles */

@font-face {
  font-family: "Montserrat";
  src: url("../assets/fonts/Montserrat-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("../assets/fonts/Montserrat-ExtraBold.ttf") format("truetype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "TrajanPro";
  src: url("../assets/fonts/TrajanPro-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "TrajanPro";
  src: url("../assets/fonts/TrajanPro-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy: #24324a;
  --navy-deep: #162f49;
  --blue: #345385;
  --blue-bright: #185288;
  --soft-blue: #96b0c9;
  --ink: #1a2332;
  --muted: #5a6a7a;
  --line: #d5dde6;
  --paper: #ffffff;
  --paper-alt: #f4f7fa;
  --bg: #e8eef4;
  --red: #b42318;
  --green: #1f7a3f;
  --yellow: #e6b800;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(22, 47, 73, 0.08);
  --font: "Montserrat", "Segoe UI", sans-serif;
  --font-display: "TrajanPro", "Times New Roman", serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-weight: 500;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(152, 176, 201, 0.35), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(52, 83, 133, 0.18), transparent 55%),
    var(--bg);
  min-height: 100vh;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.app-header__inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.app-header__logo {
  height: 48px;
  width: auto;
}

.app-header__text h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy-deep);
  letter-spacing: 0.02em;
}

.app-header__text p {
  margin: 0.1rem 0 0;
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue-bright);
}

.app-header__actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.02em;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.btn--primary {
  background: var(--navy-deep);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: var(--blue);
}

.btn--ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--navy);
}

.btn--ghost:hover {
  border-color: var(--soft-blue);
  color: var(--blue-bright);
}

.layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.25rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 480px);
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.workspace {
  min-width: 0;
}

.preview-pane {
  position: sticky;
  top: 5.5rem;
  min-width: 0;
}

.preview-pane__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.preview-pane__header h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--navy-deep);
}

.preview-pane__hint {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.preview-frame {
  background: #cfd8e3;
  border-radius: var(--radius);
  padding: 0.85rem;
  box-shadow: var(--shadow);
  overflow: auto;
  max-height: calc(100vh - 7rem);
}

.preview-scale {
  width: 100%;
  display: flex;
  justify-content: center;
}

/* Scale letter preview to fit sidebar */
.preview-scale .scorecard {
  width: 8.5in;
  min-height: 11in;
  transform-origin: top center;
  transform: scale(0.52);
  margin-bottom: calc(-11in * 0.48);
}

@media (max-width: 1100px) {
  .preview-pane {
    position: static;
  }
  .preview-frame {
    max-height: none;
  }
  .preview-scale .scorecard {
    transform: scale(0.7);
    margin-bottom: calc(-11in * 0.3);
  }
}

@media (max-width: 700px) {
  .preview-scale .scorecard {
    transform: scale(0.42);
    margin-bottom: calc(-11in * 0.58);
  }
  .app-header__logo {
    height: 40px;
  }
  .app-header__text h1 {
    font-size: 0.92rem;
  }
}

.banner {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
}

.banner--error {
  background: #fdecea;
  color: #7a1c14;
  border: 1px solid #f3c0ba;
}

.banner--success {
  background: #e8f6ee;
  color: #14532d;
  border: 1px solid #b7e0c5;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.panel__header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy-deep);
}

.panel__header p {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.panel__grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 1rem;
}

.panel__grid--priorities {
  grid-template-columns: 1fr;
}

@media (max-width: 700px) {
  .panel__grid {
    grid-template-columns: 1fr;
  }
}

.field__label {
  display: block;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 0.35rem;
}

.req {
  color: var(--red);
  margin-left: 0.15rem;
}

.field input[type="text"],
.field input[type="number"],
.field input[type="date"],
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  background: #fff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(52, 83, 133, 0.15);
}

.input-affix {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.input-affix:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(52, 83, 133, 0.15);
}

.input-affix input {
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  flex: 1;
  min-width: 0;
}

.input-affix__prefix,
.input-affix__suffix {
  display: flex;
  align-items: center;
  padding: 0 0.65rem;
  background: var(--paper-alt);
  color: var(--muted);
  font-weight: 800;
  font-size: 0.85rem;
}

.field__helper {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.35;
}

.field__error {
  margin: 0.3rem 0 0;
  min-height: 1em;
  font-size: 0.75rem;
  color: var(--red);
  font-weight: 700;
}

.field--error input,
.field--error select,
.field--error textarea,
.field--error .input-affix {
  border-color: var(--red) !important;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
}

.segmented__option {
  position: relative;
  cursor: pointer;
}

.segmented__option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented__option span {
  display: block;
  text-align: center;
  padding: 0.5rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--muted);
}

.segmented__option input:checked + span {
  background: var(--navy-deep);
  border-color: var(--navy-deep);
  color: #fff;
}

.segmented__option:hover span {
  border-color: var(--soft-blue);
}

.status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.chip--green {
  background: #e8f6ee;
  color: var(--green);
}
.chip--yellow {
  background: #fff8db;
  color: #8a6d00;
}
.chip--red {
  background: #fdecea;
  color: var(--red);
}

.app-footer {
  max-width: 1440px;
  margin: 0 auto 1.5rem;
  padding: 0 1.25rem;
  color: var(--muted);
  font-size: 0.78rem;
}

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