/* Peta Polygon tool — extends tokens/components from styles.css */
/* .main-nav a[aria-current="page"] styling now lives in the shared styles.css */

/* ===== Page shell ===== */
html,
body {
  height: 100%;
}

body.polygon-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.polygon-main {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
}

.polygon-layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 420px 1fr;
  min-height: 0;
}

/* ===== Left panel ===== */
.polygon-panel {
  border-right: 1px solid var(--hairline);
  padding: 40px 40px 64px;
  overflow-y: auto;
  min-height: 0;
}

.polygon-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 16px;
}

.polygon-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 36px;
  line-height: 1.1;
  margin: 0 0 14px;
}

.polygon-intro {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 28px;
}

/* ===== Subtabs ===== */
.subtabs {
  display: flex;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 12px;
}

.subtab-btn {
  flex: 1 1 0;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
}

.subtab-btn:hover {
  color: var(--navy);
}

.subtab-btn[aria-selected="true"] {
  color: var(--navy);
  border-bottom-color: var(--gold);
}

/* KKPR is the default-active tab; hide AMDALNET panels until JS switches tabs. */
[data-tab-panel="amdalnet"] {
  display: none;
}

.step {
  padding: 28px 0;
  border-top: 1px solid var(--hairline);
}

.step:first-of-type {
  border-top: none;
  padding-top: 0;
}

.step-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

.step-num {
  font-family: var(--font-serif);
  font-size: 26px;
  color: var(--gold);
  line-height: 1;
}

.step-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 400;
  color: var(--navy);
}

.step-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 10px;
}

/* ===== Point rows ===== */
.point-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.point-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.point-badge {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--ivory);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.point-row input[type="text"] {
  flex: 1 1 0;
  min-width: 0;
  font-family: inherit;
  font-size: 13px;
  padding: 9px 10px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: #fff;
  color: var(--navy);
}

.point-row input[type="text"]:focus {
  outline: none;
  border-color: var(--gold);
}

.point-remove {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: color 150ms ease;
}

.point-remove:hover {
  color: var(--gold);
}

/* ===== Buttons (page-local variants) ===== */
.btn-outline {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--navy);
  font-size: 13px;
  padding: 10px 20px;
  letter-spacing: 0.03em;
}

.btn-outline:hover {
  background: rgba(28, 36, 51, 0.06);
}

.btn-text {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--hairline);
  text-underline-offset: 2px;
}

.btn-text:hover {
  color: var(--gold);
  text-decoration-color: var(--gold);
}

.btn-block {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 8px;
}

.btn[disabled],
.btn-outline[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.step-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 18px;
}

/* ===== Luas / stats ===== */
.luas-display {
  font-size: 14px;
  color: var(--muted);
  background: rgba(28, 36, 51, 0.04);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.luas-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.luas-ha {
  font-size: 14px;
  color: var(--muted);
}

.luas-display strong {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--navy);
  font-weight: 400;
  margin-right: 6px;
}

.luas-m2 {
  font-size: 12px;
  color: var(--muted);
  opacity: 0.75;
  margin-top: 2px;
}

.luas-oss {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.65;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--hairline);
  cursor: help;
}

/* ===== Warnings ===== */
.warning {
  display: none;
  font-size: 12px;
  line-height: 1.5;
  color: #8a3b1f;
  background: rgba(168, 89, 47, 0.1);
  border: 1px solid rgba(168, 89, 47, 0.25);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-top: 12px;
}

.warning.is-visible {
  display: block;
}

.warning.is-error {
  color: #7a1f1f;
  background: rgba(168, 47, 47, 0.1);
  border-color: rgba(168, 47, 47, 0.25);
}

/* ===== Attribute form ===== */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}

.field .field-note {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 4px;
}

.field input[type="text"],
.field textarea {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: #fff;
  color: var(--navy);
}

.field input[type="text"]:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--gold);
}

.field input[disabled] {
  background: rgba(28, 36, 51, 0.04);
  color: var(--muted);
}

.field textarea {
  resize: vertical;
  min-height: 64px;
}

.info-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  font-style: italic;
  margin-top: 4px;
}

/* ===== Checklist ===== */
.checklist {
  display: none;
  margin-top: 18px;
  padding: 16px;
  background: var(--navy);
  color: var(--ivory);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.6;
}

.checklist.is-visible {
  display: block;
}

.checklist .check-line {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.checklist .check-line + .check-line {
  margin-top: 8px;
}

.checklist .check-mark {
  color: var(--gold-light);
  font-family: var(--font-serif);
}

/* ===== Collapsible guide ===== */
.guide {
  margin-top: 32px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
}

.guide summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 18px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.guide summary::after {
  content: "+";
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--gold);
}

.guide[open] summary::after {
  content: "\2212";
}

.guide-body {
  padding: 0 18px 18px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.guide-body ol {
  margin: 0;
  padding-left: 20px;
}

.guide-body li + li {
  margin-top: 8px;
}

/* Coordinate-acquisition guide (Step 1, shared across both subtabs) */
.coord-guide {
  margin-top: 0;
  margin-bottom: 20px;
}

.coord-guide summary {
  align-items: flex-start;
}

.coord-guide summary::after {
  align-self: center;
}

.coord-guide-summary-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.coord-guide-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.3;
}

.coord-guide-hint {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.coord-guide-method {
  margin-top: 20px;
}

.coord-guide-method:first-child {
  margin-top: 0;
}

.coord-guide-method-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 400;
  color: var(--navy);
  margin: 0 0 8px;
}

.coord-guide-tips {
  margin-top: 20px;
  padding: 14px 16px;
  background: rgba(168, 134, 47, 0.08);
  border: 1px solid rgba(168, 134, 47, 0.25);
  border-radius: var(--radius);
}

.coord-guide-tips-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--navy);
  margin: 0 0 8px;
}

.coord-guide-tips ul {
  margin: 0;
  padding-left: 20px;
}

.coord-guide-tips li + li {
  margin-top: 6px;
}

/* ===== Map ===== */
.polygon-map-wrap {
  position: relative;
  min-height: 0;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 480px;
  background: var(--hairline);
}

.map-search {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 500;
  display: flex;
  gap: 6px;
  background: #fff;
  padding: 8px;
  border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(28, 36, 51, 0.18);
}

.map-search input {
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  width: 220px;
}

.map-search input:focus {
  outline: none;
  border-color: var(--gold);
}

.map-search button {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  background: var(--navy);
  color: var(--ivory);
  cursor: pointer;
  transition: background-color 150ms ease;
}

.map-search button:hover {
  background: #10151f;
}

/* Numbered point markers */
.point-marker {
  background: var(--navy);
  color: var(--ivory);
  border: 2px solid var(--ivory);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-sans);
  box-shadow: 0 1px 4px rgba(28, 36, 51, 0.35);
}

/* ===== Slim tool-page footer =====
   This page is a working tool, not a marketing page, so it skips the
   shared .site-footer (big serif statement + gold button + hairline
   divider) in favor of one slim navy bar. Not used by any other page. */
.polygon-footer {
  flex: 0 0 auto;
  background: var(--navy);
  min-height: 56px;
  padding: 12px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.polygon-footer-brand {
  font-size: 13px;
  color: rgba(247, 244, 238, 0.6);
}

.polygon-footer-links {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.polygon-footer-cta {
  font-size: 14px;
  color: var(--gold-light);
  text-decoration: none;
}

.polygon-footer-cta:hover {
  text-decoration: underline;
}

/* ===== Responsive ===== */
@media (max-width: 960px) {
  .polygon-main {
    display: block;
  }

  .polygon-layout {
    display: block;
  }

  .polygon-panel {
    border-right: none;
    border-bottom: 1px solid var(--hairline);
    overflow-y: visible;
  }

  .polygon-map-wrap {
    height: 480px;
  }
}

@media (max-width: 640px) {
  .polygon-panel {
    padding: 32px 24px 48px;
  }

  .polygon-title {
    font-size: 28px;
  }

  .map-search {
    left: 8px;
    top: 8px;
    right: 8px;
  }

  .map-search input {
    width: auto;
    flex: 1;
  }
}
