/* =========================================================================
   Consult Navigation Agency — Marine Service Calculator (demo frontend)
   Brand palette sourced from consultmarinesupply.com (teal #0F6F59 / navy-teal
   #003B49), paired with a gold accent. Frontend-only file: no calculation
   logic lives here, this only renders whatever the API returns.
   ========================================================================= */

/* -------------------------------------------------------------------------
   IMAGE PLACEHOLDERS — replace this custom property with your own
   photography later. Everything else in the file references it, so
   swapping this one line is enough to change the hero image.
   Recommended size: ~1920x1200 (landscape, ship/canal/port subject).
   ------------------------------------------------------------------------- */
:root {
  --img-hero: url('https://images.unsplash.com/photo-1524522173746-f628baad3644?auto=format&fit=crop&w=1920&q=80');
}

:root {
  color-scheme: light;

  /* Brand — teal/navy from consultmarinesupply.com, gold accent */
  --navy-950: #001b21;
  --navy-900: #003b49;
  --navy-800: #0a4a58;
  --navy-700: #14596a;
  --teal-600: #0f6f59;
  --teal-500: #158a6e;
  --teal-100: #e6f3ef;
  --gold-600: #a97c26;
  --gold-500: #c99a3d;
  --gold-400: #dcb15c;
  --gold-100: #faf1de;

  --ink: #12262b;
  --muted: #5c7078;
  --muted-2: #7c8f95;
  --soft: #f4f7f6;
  --panel: #ffffff;
  --line: #dde6e3;
  --line-strong: #c7d3cf;

  --danger: #b3261e;
  --danger-bg: #fdecea;
  --danger-line: #f3c6c1;
  --success: #1f7a4d;
  --success-bg: #e9f7ef;
  --success-line: #bfe3cd;

  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 7px;

  --shadow-lg: 0 30px 70px rgba(0, 35, 40, 0.20);
  --shadow-md: 0 14px 34px rgba(0, 35, 40, 0.10);
  --shadow-sm: 0 4px 12px rgba(0, 35, 40, 0.08);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--soft);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', 'Segoe UI', Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

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

a {
  color: var(--teal-600);
}

/* ---------- shell & reveal-on-scroll ---------- */

.page-shell {
  min-width: 0;
}

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 640ms var(--ease), transform 640ms var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1.is-visible { transition-delay: 90ms; }
.reveal-delay-2.is-visible { transition-delay: 180ms; }
.reveal-delay-3.is-visible { transition-delay: 270ms; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  background: var(--navy-900);
  padding: 26px 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--img-hero);
  background-size: cover;
  background-position: center 42%;
  opacity: 0.6;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(0, 20, 25, 0.97) 0%, rgba(0, 24, 29, 0.87) 24%, rgba(0, 30, 36, 0.5) 52%, rgba(0, 33, 40, 0.66) 100%),
    linear-gradient(0deg, var(--navy-900) 0%, transparent 22%),
    radial-gradient(1100px 520px at 12% -10%, rgba(15, 111, 89, 0.4), transparent 60%);
}

.hero-inner {
  position: relative;
  z-index: 1;
  width: min(1400px, calc(100% - 48px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(560px, 660px);
  gap: 48px;
  align-items: center;
}

.hero-copy {
  color: #ffffff;
  align-self: center;
}

.eyebrow,
.modal-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--gold-400);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1.page-title {
  max-width: 540px;
  margin-bottom: 12px;
  font-size: clamp(2.1rem, 3.6vw, 3.1rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

h1.page-title .accent {
  color: var(--gold-500);
}

.hero-text {
  max-width: 460px;
  margin-bottom: 18px;
  color: #cfe1de;
  font-size: 0.98rem;
}

.trust-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
}

.trust-line span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #d3e4e1;
  font-size: 0.82rem;
  font-weight: 700;
}

.trust-line i {
  color: var(--gold-400);
  font-size: 0.82rem;
}

/* ---------- calculator card ---------- */

.calc-card {
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.card-titlebar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 18px 26px;
}

.card-titlebar-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.card-icon {
  display: inline-grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--navy-900);
  color: var(--gold-400);
  font-size: 1.05rem;
}

.card-titlebar h2 {
  margin: 0;
  color: var(--navy-950);
  font-size: 1.14rem;
  letter-spacing: -0.01em;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--navy-800);
  padding: 8px 13px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 160ms var(--ease), color 160ms var(--ease), background 160ms var(--ease), transform 160ms var(--ease);
}

.ghost-btn:hover:not(:disabled) {
  border-color: var(--teal-600);
  color: var(--teal-600);
  background: var(--teal-100);
  transform: translateY(-1px);
}

.service-status {
  display: inline-flex;
  align-items: center;
  margin-top: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 700;
}

.service-status::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: #a8b6c1;
}

.service-status.is-ok {
  border-color: var(--success-line);
  background: var(--success-bg);
  color: var(--success);
}

.service-status.is-ok::before {
  background: var(--success);
}

.service-status.is-error {
  border-color: var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger);
}

.service-status.is-error::before {
  background: var(--danger);
}

form {
  display: block;
}

.form-body {
  padding: 20px 26px;
}

.form-section {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.form-section + .form-section {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.form-section legend {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin-bottom: 13px;
  color: var(--navy-950);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.form-section legend::after {
  content: "";
  flex: 1 1 auto;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold-500), transparent);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px;
}

.field-span2 {
  grid-column: 1 / -1;
}

.field {
  min-width: 0;
}

label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 6px;
  color: var(--navy-900);
  font-size: 0.8rem;
  font-weight: 700;
}

.field > label span {
  color: var(--gold-600);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.input-wrap {
  position: relative;
}

.input-wrap i {
  position: absolute;
  top: 50%;
  left: 13px;
  transform: translateY(-50%);
  color: var(--muted-2);
  font-size: 0.85rem;
  pointer-events: none;
}

.input-wrap input,
.input-wrap select {
  padding-left: 34px;
}

input,
select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--ink);
  padding: 8px 12px;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease), background 160ms var(--ease);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%235c7078' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

input::placeholder {
  color: #9fb0ac;
}

input:disabled,
select:disabled {
  background: #eef3f1;
  color: #93a4a0;
  cursor: not-allowed;
}

input:hover:not(:disabled):not(:focus),
select:hover:not(:disabled):not(:focus) {
  border-color: var(--muted-2);
}

input:focus,
select:focus,
button:focus-visible,
summary:focus-visible,
a:focus-visible,
.choice-options label:focus-within {
  outline: 3px solid rgba(15, 111, 89, 0.28);
  outline-offset: 1px;
  border-color: var(--teal-600);
}

.field.has-error input,
.field.has-error select {
  border-color: var(--danger);
  background: #fffaf9;
  box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.1);
}

.field-error {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 7px 0 0;
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 700;
}

.field-error::before {
  font: normal normal normal 14px/1 "Font Awesome 6 Free";
  font-weight: 900;
  content: "\f06a";
}

.hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.choice-options {
  display: flex;
  gap: 8px;
}

.choice-options label {
  min-width: 78px;
  justify-content: center;
  gap: 7px;
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  padding: 0 14px;
  min-height: 42px;
  cursor: pointer;
  transition: border-color 160ms var(--ease), background 160ms var(--ease), color 160ms var(--ease);
}

.choice-options label:has(input:checked) {
  border-color: var(--navy-900);
  background: var(--navy-900);
  color: #ffffff;
}

.choice-options input {
  width: auto;
  min-height: 0;
}

.choice-options-compact {
  width: 100%;
}

.choice-options-compact label {
  flex: 1 1 0;
}

.actions {
  display: flex;
  border-top: 1px solid var(--line);
  background: #ffffff;
  padding: 18px 26px;
}

button {
  min-height: 46px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 800;
  transition: transform 160ms var(--ease), box-shadow 160ms var(--ease), background 160ms var(--ease), border-color 160ms var(--ease);
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  border: 1px solid var(--gold-500);
  background: linear-gradient(180deg, var(--gold-400), var(--gold-500));
  color: #221703;
  font-size: 0.98rem;
  box-shadow: 0 16px 30px rgba(201, 154, 61, 0.32);
}

.primary-action:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 20px 36px rgba(201, 154, 61, 0.4);
  background: linear-gradient(180deg, var(--gold-500), var(--gold-600));
}

.primary-action:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  cursor: wait;
  opacity: 0.75;
  transform: none;
}

.fa-spinner {
  display: none;
}

.is-loading .fa-calculator {
  display: none;
}

.is-loading .fa-spinner {
  display: inline-block;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =========================================================================
   Result / error modal
   ========================================================================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 20, 25, 0.6);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 260ms var(--ease);
}

.modal-overlay.is-open {
  opacity: 1;
}

.modal-overlay.is-hidden {
  display: none;
}

.modal {
  position: relative;
  width: min(640px, 100%);
  max-height: min(88vh, 820px);
  overflow-y: auto;
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  transform: translateY(18px) scale(0.98);
  opacity: 0;
  transition: transform 300ms var(--ease), opacity 260ms var(--ease);
}

.modal-overlay.is-open .modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  .modal {
    transition: none;
  }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #ffffff;
  color: var(--navy-800);
  cursor: pointer;
  transition: border-color 160ms var(--ease), color 160ms var(--ease), background 160ms var(--ease), transform 160ms var(--ease);
}

.modal-close:hover {
  border-color: var(--teal-600);
  color: var(--teal-600);
  background: var(--teal-100);
  transform: rotate(90deg);
}

.modal-view.is-hidden {
  display: none;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 26px 56px 20px 26px;
}

.modal-header-icon {
  display: inline-grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  font-size: 1.15rem;
}

.modal-header-result {
  background: linear-gradient(180deg, var(--teal-100), transparent);
}

.modal-header-result .modal-header-icon {
  background: var(--navy-900);
  color: var(--gold-400);
}

.modal-header-error .modal-header-icon {
  background: var(--danger-bg);
  color: var(--danger);
}

.modal-kicker-error {
  color: var(--danger);
}

.modal-header h2 {
  margin: 0;
  color: var(--navy-950);
  font-size: 1.24rem;
  letter-spacing: -0.01em;
}

.modal-body {
  padding: 0 26px 22px;
}

.modal-error-lead {
  margin: 0 0 14px;
  color: var(--ink);
  font-size: 0.94rem;
}

.modal-error-list {
  display: grid;
  gap: 9px;
  margin: 0 0 8px;
  padding: 14px 16px;
  list-style: none;
  border: 1px solid var(--danger-line);
  border-radius: var(--radius-md);
  background: var(--danger-bg);
}

.modal-error-list li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 600;
}

.modal-error-list li::before {
  font: normal normal normal 13px/1.4 "Font Awesome 6 Free";
  font-weight: 900;
  content: "\f06a";
  flex: 0 0 auto;
  margin-top: 2px;
}

.modal-footer {
  border-top: 1px solid var(--line);
  background: var(--soft);
  padding: 16px 26px;
}

.modal-footer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.modal-primary-btn {
  width: auto;
  padding: 0 22px;
  box-shadow: none;
}

.modal-footer-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
}

/* total highlight (result modal) */

.total-highlight {
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--navy-900), var(--navy-800));
  padding: 22px 24px;
  margin-bottom: 18px;
  text-align: center;
}

.total-highlight span {
  display: block;
  color: var(--gold-400);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.total-highlight strong {
  display: block;
  margin-top: 6px;
  color: #ffffff;
  font-size: clamp(1.9rem, 4vw, 2.5rem);
  letter-spacing: -0.01em;
}

.total-highlight-note {
  margin: 4px 0 0;
  color: #cfe1de;
  font-size: 0.8rem;
}

.total-highlight-note:empty {
  display: none;
}

/* summary cards */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.summary-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fbfdfc;
  padding: 14px;
  transition: border-color 160ms var(--ease), background 160ms var(--ease);
}

.summary-box:hover {
  border-color: var(--teal-600);
  background: var(--teal-100);
}

.summary-box i {
  display: inline-grid;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--navy-900);
  color: var(--gold-400);
  font-size: 0.78rem;
}

.summary-box span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.summary-box strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--navy-950);
  font-size: 0.94rem;
}

.summary-box small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.7rem;
}

.details-table-wrap h3 {
  margin: 0 0 10px;
  color: var(--navy-950);
  font-size: 0.94rem;
}

.details-table-wrap {
  margin-bottom: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border: 1px solid var(--line);
  padding: 9px 11px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--soft);
  color: var(--navy-900);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

td {
  color: var(--ink);
  font-size: 0.87rem;
  overflow-wrap: anywhere;
}

.fine-print {
  margin: 10px 0 0;
  color: var(--muted-2);
  font-size: 0.78rem;
}

.developer-section {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.details-block {
  margin-top: 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.details-block:first-child {
  margin-top: 0;
}

summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 11px 13px;
  color: var(--navy-900);
  font-size: 0.85rem;
  font-weight: 800;
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  font: normal normal normal 12px/1 "Font Awesome 6 Free";
  font-weight: 900;
  content: "\f105";
  color: var(--muted-2);
  transition: transform 160ms var(--ease);
}

details[open] summary::before {
  transform: rotate(90deg);
}

.table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

.table-wrap table {
  min-width: 560px;
}

.sources-list {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 12px;
}

.source-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--soft);
  padding: 12px;
}

.source-item h4 {
  margin: 0 0 6px;
  color: var(--navy-950);
  font-size: 0.9rem;
}

.source-item p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.8rem;
}

.source-item a {
  color: var(--teal-600);
  font-weight: 800;
}

.request-id-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  padding: 7px 13px;
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.request-id-chip i {
  color: var(--muted-2);
}

.raw-response pre {
  max-height: 300px;
  overflow: auto;
  margin: 0;
  border-top: 1px solid var(--line);
  background: var(--navy-950);
  color: #eef5f3;
  padding: 14px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.8rem;
}

.is-hidden {
  display: none !important;
}

/* ---------- responsive ---------- */

@media (max-width: 1180px) {
  .hero-inner {
    grid-template-columns: minmax(0, 1fr) minmax(480px, 560px);
    gap: 32px;
  }
}

@media (max-width: 980px) {
  .hero {
    min-height: 0;
    padding: 32px 0;
  }

  .hero-inner {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .calc-card {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
  }
}

@media (max-width: 760px) {
  .hero-inner {
    width: min(100% - 24px, 1400px);
  }

  .form-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .card-titlebar {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-body,
  .actions,
  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .modal-overlay {
    padding: 14px;
    align-items: flex-end;
  }

  .modal {
    width: 100%;
    max-height: 92vh;
  }

  .modal-footer-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .modal-footer-note {
    text-align: left;
  }
}

@media (max-width: 480px) {
  h1.page-title {
    font-size: 2.1rem;
  }
}
.card-icon img{
    width:42px;
    height:42px;
    object-fit:contain;
    display:block;
}
