:root {
  --ink: #14213d;
  --muted: #667085;
  --line: #e5eaf1;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --primary: #2457d6;
  --primary-dark: #193fa3;
  --success: #087a55;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  color: var(--ink);
  background: var(--surface-soft);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

a {
  color: var(--primary);
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.navbar {
  min-height: 72px;
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -.04em;
}

.navbar-brand:hover {
  color: var(--ink);
}

.brand-logo {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(36, 87, 214, .18);
}

.brand-text span {
  color: var(--primary);
}

.navbar .nav-link {
  color: #344054;
  font-weight: 600;
  margin-left: 1rem;
}

main {
  padding-bottom: 5rem;
}

.hero {
  max-width: 850px;
  margin: 0 auto;
  padding: 7rem 1rem 6rem;
}

.hero-logo {
  display: inline-block;
  width: 84px;
  height: 84px;
  margin-bottom: 1.5rem;
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(36, 87, 214, .18);
}

.eyebrow {
  display: block;
  margin-bottom: .8rem;
  color: var(--primary);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.hero h1,
.tool-hero h1 {
  margin-bottom: .75rem;
  font-size: clamp(2.75rem, 8vw, 5rem);
  font-weight: 800;
  letter-spacing: -.055em;
  line-height: 1;
}

.hero-subtitle {
  margin-bottom: 1rem;
  color: #344054;
  font-size: clamp(1.25rem, 3vw, 1.65rem);
  font-weight: 650;
}

.hero-copy {
  max-width: 660px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1.08rem;
}

.tools-section {
  padding-bottom: 2rem;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  font-weight: 750;
  letter-spacing: -.035em;
}

.section-heading p {
  max-width: 360px;
  margin: 0;
  color: var(--muted);
}

.tool-card {
  position: relative;
  display: block;
  height: 100%;
  min-height: 245px;
  padding: 1.5rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  text-decoration: none;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.tool-card-active:hover {
  color: var(--ink);
  border-color: #aebff0;
  box-shadow: 0 14px 35px rgba(36, 87, 214, .1);
  transform: translateY(-3px);
}

.tool-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 1.4rem;
  color: var(--primary);
  background: #eef3ff;
  border-radius: 12px;
  font-size: .78rem;
  font-weight: 800;
}

.tool-status {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.tool-status.active {
  color: var(--success);
}

.tool-card h3 {
  margin-bottom: .55rem;
  font-size: 1.15rem;
  font-weight: 750;
}

.tool-card p {
  margin-bottom: .8rem;
  color: var(--muted);
}

.tool-link {
  color: var(--primary);
  font-weight: 700;
}

.tool-hero {
  max-width: 780px;
  padding: 4.5rem 0 2.5rem;
}

.tool-hero h1 {
  font-size: clamp(2.5rem, 7vw, 4.25rem);
}

.tool-hero p {
  color: var(--muted);
  font-size: 1.1rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  color: #475467;
  font-weight: 650;
  text-decoration: none;
}

.lookup-panel,
.port-check-panel,
.browser-tool-panel,
.result-card,
.map-card,
.content-card,
.legal-page {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.lookup-panel {
  padding: 1.5rem;
  box-shadow: 0 10px 35px rgba(20, 33, 61, .05);
}

.lookup-form,
.port-check-form {
  display: flex;
  align-items: end;
  gap: 1rem;
}

.port-check-panel {
  padding: 1.5rem;
  box-shadow: 0 10px 35px rgba(20, 33, 61, .05);
}

.browser-tool-panel {
  padding: 1.5rem;
  box-shadow: 0 10px 35px rgba(20, 33, 61, .05);
}

.tool-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.tool-actions,
.tool-options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .65rem;
}

.tool-options .form-select {
  width: auto;
  min-width: 128px;
}

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

.editor-pane {
  min-width: 0;
}

.editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .5rem;
}

.editor-heading label,
.editor-heading span:first-child {
  color: #344054;
  font-size: .9rem;
  font-weight: 700;
}

.editor-meta {
  color: var(--muted);
  font-size: .78rem;
}

.code-editor {
  width: 100%;
  min-height: 440px;
  padding: 1rem;
  color: #17233f;
  background: #fbfcfe;
  border: 1px solid #cfd7e6;
  border-radius: 12px;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: .9rem;
  line-height: 1.55;
  resize: vertical;
  tab-size: 2;
  white-space: pre;
}

.code-editor:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 .2rem rgba(36, 87, 214, .12);
}

.code-editor[readonly] {
  background: #f6f8fc;
}

.code-editor-compact {
  min-height: 220px;
}

.json-modal-body {
  display: flex;
  min-height: 0;
  padding: 1rem;
}

.json-expanded-editor {
  flex: 1;
  min-height: calc(100vh - 105px);
  resize: none;
}

.html-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
}

.html-code-editor,
.html-preview-frame {
  min-height: 600px;
}

.html-preview-frame,
.html-expanded-preview {
  display: block;
  width: 100%;
  background: #fff;
  border: 1px solid #cfd7e6;
  border-radius: 12px;
}

.html-preview-modal-body {
  display: flex;
  min-height: 0;
  padding: 1rem;
  background: #f6f8fc;
}

.html-expanded-preview {
  flex: 1;
  min-height: calc(100vh - 105px);
}

.tool-feedback {
  display: none;
  margin: 1rem 0 0;
  padding: .8rem 1rem;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 650;
}

.tool-feedback.is-visible {
  display: block;
}

.tool-feedback.is-success {
  color: #05603f;
  background: #eaf8f2;
  border: 1px solid #b7e4d2;
}

.tool-feedback.is-error {
  color: #912018;
  background: #fff0ee;
  border: 1px solid #f4c7c3;
}

.privacy-note {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: .85rem;
}

.privacy-note strong {
  color: #344054;
}

.timestamp-now {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1rem 1.15rem;
  background: #f6f8fc;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.timestamp-now strong {
  display: block;
  color: var(--ink);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.timestamp-now-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.timestamp-converter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.timestamp-converter-card {
  padding: 1.25rem;
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.timestamp-converter-card h2 {
  margin-bottom: 1.25rem;
  font-size: 1.2rem;
  font-weight: 750;
}

.timestamp-converter-card .btn {
  width: 100%;
}

.file-tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, .45fr);
  gap: 1rem;
  align-items: end;
}

.file-picker {
  display: block;
  padding: 1.25rem;
  color: #344054;
  background: #fbfcfe;
  border: 1px dashed #aeb9cb;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease;
}

.file-picker:hover,
.file-picker:focus-within {
  background: #f4f7fd;
  border-color: var(--primary);
}

.file-picker input {
  display: block;
  width: 100%;
  margin-top: .65rem;
}

.file-picker-title {
  display: block;
  font-weight: 750;
}

.file-picker-copy {
  display: block;
  margin-top: .2rem;
  color: var(--muted);
  font-size: .88rem;
}

.selected-file {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: .88rem;
}

.converter-feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin-bottom: 1.25rem;
}

.converter-chip {
  display: inline-flex;
  align-items: center;
  padding: .45rem .7rem;
  color: var(--muted);
  background: #f6f8fc;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 700;
}

.converter-chip.is-active {
  color: var(--success);
  background: #eaf8f2;
  border-color: #b7e4d2;
}

.tool-panel-title {
  margin-bottom: 1rem;
  font-size: 1.25rem;
  font-weight: 750;
}

.file-action-card {
  padding: 1.25rem;
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.image-converter-note {
  margin: .85rem 0 0;
  color: var(--muted);
  font-size: .88rem;
}

.xml-preview-card {
  display: none;
  margin-top: 1.5rem;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.xml-preview-card.is-visible {
  display: block;
}

.xml-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.xml-preview-header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 750;
}

.xml-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
}

.xml-preview-frame {
  display: block;
  width: 100%;
  height: 760px;
  background: #fff;
  border: 0;
}

.tool-warning {
  margin-top: 1rem;
  padding: .85rem 1rem;
  color: #7a4b00;
  background: #fff8e6;
  border: 1px solid #f1d28a;
  border-radius: 10px;
  font-size: .88rem;
}

.port-field {
  flex: 0 0 150px;
}

.port-result-open {
  color: var(--success);
}

.port-result-closed {
  color: #b42318;
}

.result-summary {
  padding: 1.5rem;
  border-top: 1px solid var(--line);
}

.result-summary p {
  margin: 0;
  color: var(--muted);
}

.form-label {
  color: #344054;
  font-size: .9rem;
  font-weight: 700;
}

.form-control {
  border-color: #cfd7e6;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 .2rem rgba(36, 87, 214, .12);
}

.btn-primary {
  min-width: 145px;
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 700;
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.validation-message {
  display: block;
  margin-top: .35rem;
  color: #b42318;
  font-size: .88rem;
}

.result-alert {
  margin-top: 1.5rem;
}

.result-card {
  margin-top: 1.5rem;
  overflow: hidden;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.result-header .eyebrow {
  margin-bottom: .4rem;
}

.result-header h2 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 750;
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
}

.result-badge {
  padding: .35rem .7rem;
  color: var(--success);
  background: #eaf8f2;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 750;
  white-space: nowrap;
}

.result-badge.is-warning {
  color: #854d0e;
  background: #fff7d6;
}

.result-badge.is-danger {
  color: #912018;
  background: #fff0ee;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.result-grid > div {
  padding: 1.35rem 1.5rem;
  border-bottom: 1px solid var(--line);
}

.result-grid > div:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.result-grid dt {
  margin-bottom: .25rem;
  color: var(--muted);
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.result-grid dd {
  margin: 0;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.map-card {
  margin-top: 1.5rem;
  padding: 1.5rem;
  overflow: hidden;
}

.map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.map-header .eyebrow {
  margin-bottom: .35rem;
}

.map-header h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 750;
}

.map-link {
  font-size: .9rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.location-map {
  display: block;
  width: 100%;
  height: 360px;
  border: 0;
  border-radius: 12px;
  background: #eef1f6;
}

.map-note {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: .88rem;
}

.content-card {
  margin-top: 1.5rem;
  padding: 1.75rem;
}

.content-card h2 {
  font-size: 1.35rem;
  font-weight: 750;
}

.content-card p {
  color: var(--muted);
}

.legal-page {
  max-width: 800px;
  margin: 5rem auto 0;
  padding: clamp(1.5rem, 5vw, 3rem);
}

.legal-page h1 {
  font-weight: 800;
  letter-spacing: -.04em;
}

.legal-page p:not(.lead) {
  color: var(--muted);
}

.site-footer {
  margin-top: auto;
  padding: 2rem 0;
  color: var(--muted);
  background: var(--surface);
  border-top: 1px solid var(--line);
  font-size: .9rem;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.site-footer nav {
  display: flex;
  gap: 1.25rem;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

@media (max-width: 767.98px) {
  .navbar .nav-link {
    margin-left: 0;
  }

  .hero {
    padding: 5rem 0 4rem;
  }

  .section-heading,
  .lookup-form,
  .port-check-form,
  .tool-toolbar,
  .timestamp-now,
  .map-header,
  .footer-content {
    align-items: stretch;
    flex-direction: column;
  }

  .lookup-form .btn {
    width: 100%;
  }

  .port-field {
    flex-basis: auto;
  }

  .port-check-form .btn {
    width: 100%;
  }

  .tool-actions,
  .tool-options {
    width: 100%;
  }

  .tool-actions .btn {
    flex: 1 1 auto;
  }

  .tool-options .form-select {
    flex: 1;
  }

  .editor-grid {
    grid-template-columns: 1fr;
  }

  .html-editor-grid {
    grid-template-columns: 1fr;
  }

  .html-code-editor,
  .html-preview-frame {
    min-height: 420px;
  }

  .timestamp-converter-grid {
    grid-template-columns: 1fr;
  }

  .timestamp-now-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .file-tool-grid {
    grid-template-columns: 1fr;
  }

  .code-editor {
    min-height: 320px;
  }

  .xml-preview-header {
    align-items: stretch;
    flex-direction: column;
  }

  .xml-preview-actions .btn {
    flex: 1 1 auto;
  }

  .xml-preview-frame {
    height: 560px;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }

  .result-grid > div:nth-child(odd) {
    border-right: 0;
  }

  .location-map {
    height: 280px;
  }

  .site-footer nav {
    flex-wrap: wrap;
  }
}
