:root {
  color-scheme: light;

  --background: #f7f7f7;
  --surface: #ffffff;
  --surface-soft: #f2f2f2;

  --primary: #dc9239;
  --primary-dark: #c37b24;
  --primary-soft: #e6b273;

  --text: #333333;
  --heading: #292929;
  --muted: #686868;
  --border: #d8d8d8;

  --success: #28734d;
  --error: #b42318;

  --shadow: 0 20px 55px rgba(17, 17, 17, 0.09);

  --radius-large: 24px;
  --radius-medium: 15px;
  --radius-small: 10px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--background);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(
      180deg,
      #ffffff 0%,
      var(--background) 100%
    );
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(255, 79, 0, 0.3);
  outline-offset: 3px;
}

/* Header */

.site-header {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--heading);
  text-decoration: none;
}

.brand img {
  display: block;
  width: 75px;
  height: 75px;
  object-fit: contain;
}

.brand-name {
  color: var(--heading);
  font-size: 3.50rem;
  font-weight: 850;
  letter-spacing: -0.02em;
}

/* Main layout */

.page-shell {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.hero {
  max-width: 850px;
  margin-bottom: 30px;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1 {
  max-width: 800px;
  margin-bottom: 16px;
  color: var(--heading);
  font-size: clamp(1.00rem, 4vw, 2.00rem);
  line-height: 0.98;
  letter-spacing: -0.01em;
}

.intro {
  max-width: 800px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.7;
}

/* Cards */

.tool-card,
.notes-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tool-card {
  padding: clamp(20px, 4vw, 34px);
}

/* Field and results headers */

.field-header,
.results-header,
.form-actions {
  display: flex;
  align-items: center;
}

.field-header,
.results-header {
  justify-content: space-between;
  gap: 16px;
}

.field-header label {
  color: var(--heading);
  font-size: 1.96rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

/* Textareas */

textarea {
  width: 100%;
  resize: vertical;
  border: 2px solid var(--primary);
  border-radius: var(--radius-medium);
  background: var(--surface);
  color: var(--text);
  line-height: 1.55;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
}

#cidr-input {
  min-height: 190px;
  margin-top: 10px;
  padding: 16px;
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.96rem;
}

textarea::placeholder {
  color: #999999;
}

textarea:hover {
  border-color: var(--primary-dark);
}

textarea:focus {
  border-color: var(--primary-dark);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(255, 79, 0, 0.12);
  outline: none;
}

.field-help {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* Buttons */

.form-actions {
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.primary-button,
.secondary-button,
.copy-button,
.text-button {
  border: 2px solid var(--primary);
  border-radius: var(--radius-small);
  background: var(--primary);
  color: #ffffff;
  font-weight: 800;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.05s ease;
}

.primary-button,
.secondary-button,
.copy-button {
  min-height: 44px;
  padding: 12px 18px;
}

.text-button {
  padding: 7px 10px;
}

.primary-button:hover,
.secondary-button:hover,
.copy-button:hover,
.text-button:hover {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
}

.primary-button:active,
.secondary-button:active,
.copy-button:active,
.text-button:active {
  transform: translateY(1px);
}

.primary-button:disabled,
.secondary-button:disabled,
.copy-button:disabled,
.text-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* Messages */

.message {
  min-height: 24px;
  margin-top: 18px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
}

.message.success {
  color: var(--success);
}

.message.error {
  color: var(--error);
}

/* Results */

.results-panel {
  margin-top: 10px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.results-label {
  margin: 0 0 8px;
  color: var(--heading);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-transform: uppercase;
}

.results-header h2 {
  margin-bottom: 0;
  color: var(--heading);
  font-size: clamp(2rem, 4vw, 2.75rem);
  letter-spacing: -0.035em;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0;
}

.summary-item {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  background: var(--surface-soft);
}

.summary-item span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.82rem;
}

.summary-item strong {
  color: var(--heading);
  font-size: 1.45rem;
}

.normalized-block {
  margin-bottom: 18px;
}

.normalized-block h3 {
  margin-bottom: 10px;
  color: var(--heading);
  font-size: 0.92rem;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--primary);
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--heading);
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.84rem;
  font-weight: 700;
}

.results-output {
  min-height: 320px;
  padding: 16px;
  border: 2px solid var(--primary);
  background: var(--surface);
  color: var(--text);
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.93rem;
}

.results-output:hover,
.results-output:focus {
  border-color: var(--primary-dark);
  background: var(--surface);
  color: var(--text);
}

/* Notes */

.notes-card {
  margin-top: 24px;
  padding: clamp(20px, 4vw, 30px);
}

.notes-card h2 {
  margin-bottom: 10px;
  color: var(--heading);
  font-size: 1.2rem;
}

.notes-card p {
  margin-bottom: 10px;
  color: var(--muted);
  line-height: 1.65;
}

.notes-card p:last-child {
  margin-bottom: 0;
}

code {
  padding: 0.1em 0.35em;
  border-radius: 5px;
  background: var(--primary-soft);
  color: var(--heading);
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

/* Footer */

.site-footer {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 34px;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

.site-footer {
  margin-top: 3rem;
  padding: 2rem 1rem;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.95rem;
}

.footer-navigation {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.footer-navigation a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.footer-navigation a:hover,
.footer-navigation a:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

.footer-navigation span {
  color: var(--muted);
}

.footer-copyright {
  margin: 0;
  line-height: 1.6;
}

.footer-copyright a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.footer-copyright a:hover,
.footer-copyright a:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

/* Responsive layout */

@media (max-width: 640px) {
  .page-shell {
    padding-top: 28px;
  }

  .field-header,
  .results-header {
    align-items: flex-start;
  }

  .field-header {
    flex-wrap: wrap;
  }

  .field-header label {
    width: 100%;
    font-size: 1.65rem;
  }

  .results-header {
    flex-direction: column;
  }

  .copy-button {
    width: 100%;
  }

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

@media (max-width: 430px) {
  .form-actions {
    flex-direction: column;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }
}
