/* ==========================================================================
   OwnIdentity – SPF Flattening Tool
   Design system matched to check2.ownidentity.com
   ========================================================================== */

/* --- Design Tokens --- */
:root {
  --accent:       #00CFC8;
  --accent-dark:  #00a8a2;
  --secondary:    #6c6a8a;
  --bg-dark:      #222222;
  --bg-darker:    #161618;
  --bg-page:      #f7f8fa;
  --bg-surface:   #ffffff;
  --bg-input:     #fafbfc;
  --text:         #222222;
  --text-muted:   #6c6a8a;
  --text-light:   #c5c4d4;
  --border:       #e6e6ec;
  --good:         #00a884;
  --warn:         #d18a00;
  --critical:     #c0392b;
  --info:         #00CFC8;

  --radius:       10px;
  --radius-pill:  9999px;
  --shadow:       0 2px 6px rgba(34,34,34,.06);
  --shadow-lg:    0 4px 16px rgba(34,34,34,.10);

  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: 'Manrope', var(--font-body);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

code {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: .9em;
}

h1, h2, h3 { font-family: var(--font-heading); }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  background: var(--bg-dark);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: .85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
}
.brand-logo { flex-shrink: 0; }
.brand-name {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #fff;
}
.brand-name .accent { color: var(--accent); }

.site-nav { display: flex; gap: 1.6rem; }
.site-nav a {
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  opacity: .75;
  transition: opacity .2s;
}
.site-nav a:hover,
.site-nav a.active { opacity: 1; color: var(--accent); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  background: linear-gradient(180deg, var(--bg-darker), var(--bg-dark));
  text-align: center;
  padding: 3.5rem 1.5rem 3rem;
}
.hero-compact { padding: 2.2rem 1.5rem 1.8rem; }

.hero h1 {
  font-size: 2.6rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #fff;
}
.hero h1 .accent { color: var(--accent); }

.hero-sub {
  color: var(--text-light);
  font-size: 1.1rem;
  margin-top: .4rem;
}
.hero-sub strong { color: #fff; }

.hero-note {
  color: var(--accent);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 600;
  margin-top: 1rem;
}

/* ==========================================================================
   Container & Cards
   ========================================================================== */
.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}
.container > .card + .card,
.container > .score-row + .card { margin-top: 1.5rem; }

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.85rem;
}
.card h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
.card h3 {
  font-size: .95rem;
  font-weight: 700;
  margin-top: 1.2rem;
  margin-bottom: .6rem;
}
.card p { color: var(--text-muted); }
.card p + p { margin-top: .6rem; }

/* ==========================================================================
   Domain Form
   ========================================================================== */
.domain-form {
  display: flex;
  gap: .6rem;
}
.domain-form input {
  flex: 1;
  padding: .7rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
.domain-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,207,200,.15);
}
.domain-form button {
  padding: .7rem 1.8rem;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--bg-dark);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  cursor: pointer;
  transition: background .2s;
  white-space: nowrap;
}
.domain-form button:hover { background: var(--accent-dark); }

.form-error {
  margin-top: .8rem;
  padding: .65rem 1rem;
  border-radius: var(--radius);
  background: #fdf3f1;
  color: var(--critical);
  font-size: .9rem;
  font-weight: 500;
  border-left: 3px solid var(--critical);
}

/* ==========================================================================
   Feature Grid (index page)
   ========================================================================== */
.check-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}
.check-item {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
}
.check-icon {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: .15rem;
}
.check-item strong {
  display: block;
  font-size: .95rem;
  color: var(--text);
  margin-bottom: .15rem;
}
.check-item p {
  font-size: .85rem;
  margin: 0;
}
.check-item code {
  background: var(--bg-input);
  padding: .1em .35em;
  border-radius: 4px;
  font-size: .82em;
  color: var(--accent-dark);
}

.info-card p { font-size: .92rem; }
.info-note {
  margin-top: 1rem !important;
  padding: .8rem 1rem;
  border-radius: var(--radius);
  background: #f0fbfb;
  border-left: 3px solid var(--accent);
  font-size: .85rem !important;
}

/* ==========================================================================
   Score Cards Row
   ========================================================================== */
.score-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.score-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.3rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.score-ring { width: 80px; height: 80px; flex-shrink: 0; }
.score-ring svg { width: 100%; height: 100%; }

.ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 6;
}
.ring-fg {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dasharray .6s ease;
}
.ring-good .ring-fg  { stroke: var(--good); }
.ring-warn .ring-fg  { stroke: var(--warn); }
.ring-critical .ring-fg { stroke: var(--critical); }
.ring-info .ring-fg  { stroke: var(--info); }

.ring-value {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 800;
  fill: var(--text);
  text-anchor: middle;
  dominant-baseline: central;
}
.ring-label {
  font-family: var(--font-body);
  font-size: 10px;
  fill: var(--text-muted);
  text-anchor: middle;
}

.score-meta strong {
  display: block;
  font-size: .85rem;
}
.score-desc {
  font-size: .78rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Tab Bar (compact / abstract switcher)
   ========================================================================== */
.tab-bar {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.2rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: .6rem;
}
.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: .45rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
  line-height: 1.3;
}
.tab-btn:hover:not(.active) {
  color: var(--text);
  border-color: var(--accent);
}
.tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-dark);
}
.tab-meta {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: .72rem;
  text-transform: none;
  letter-spacing: 0;
  opacity: .8;
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ==========================================================================
   Record Boxes
   ========================================================================== */
.record-box {
  background: var(--bg-darker);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  overflow-x: auto;
}
.record-box code {
  color: #e0e0e0;
  font-size: .85rem;
  word-break: break-all;
  white-space: pre-wrap;
}

.flat-record { position: relative; }
.record-primary { border: 1px solid var(--accent) !important; }
.record-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .5rem;
}
.record-label {
  font-size: .8rem;
  color: var(--text-light);
}
.record-label code {
  color: var(--accent);
  font-size: .8rem;
}

.copy-btn {
  padding: .3rem .8rem;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  cursor: pointer;
  transition: all .2s;
}
.copy-btn:hover {
  background: var(--accent);
  color: var(--bg-dark);
  border-color: var(--accent);
}
.copy-btn.copied {
  background: var(--good);
  border-color: var(--good);
  color: #fff;
}

.record-stats {
  display: flex;
  gap: .5rem;
  margin-top: .6rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   Badges
   ========================================================================== */
.badge {
  display: inline-block;
  padding: .2rem .7rem;
  border-radius: var(--radius-pill);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.badge-good    { background: #eafaf5; color: var(--good); }
.badge-warn    { background: #fdf8ee; color: var(--warn); }
.badge-critical { background: #fdf3f1; color: var(--critical); }
.badge-neutral { background: var(--bg-input); color: var(--text-muted); }
.badge-info    { background: #f0fbfb; color: var(--accent-dark); }

.count-badge {
  display: inline-block;
  padding: .1rem .5rem;
  border-radius: var(--radius-pill);
  background: var(--bg-input);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: .78rem;
  font-weight: 600;
  vertical-align: middle;
  margin-left: .3rem;
}

/* ==========================================================================
   Findings
   ========================================================================== */
.finding {
  display: flex;
  gap: .75rem;
  padding: .85rem 1rem;
  border-radius: var(--radius);
  margin-top: .75rem;
  align-items: flex-start;
}
.finding strong {
  display: block;
  font-size: .88rem;
  margin-bottom: .15rem;
}
.finding p {
  font-size: .84rem;
  margin: 0;
}
.finding code {
  background: rgba(0,0,0,.06);
  padding: .1em .3em;
  border-radius: 4px;
  font-size: .82em;
}

.finding-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: .45rem;
  flex-shrink: 0;
}

.finding-critical { background: #fdf3f1; border-left: 3px solid var(--critical); }
.finding-critical .finding-dot { background: var(--critical); }
.finding-critical strong { color: var(--critical); }

.finding-warning { background: #fdf8ee; border-left: 3px solid var(--warn); }
.finding-warning .finding-dot { background: var(--warn); }
.finding-warning strong { color: var(--warn); }

.finding-info { background: #f0fbfb; border-left: 3px solid var(--info); }
.finding-info .finding-dot { background: var(--info); }
.finding-info strong { color: var(--accent-dark); }

/* ==========================================================================
   IP Grid
   ========================================================================== */
.ip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: .4rem;
}
.ip-grid-v6 {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.ip-entry {
  display: block;
  padding: .35rem .6rem;
  background: var(--bg-input);
  border-radius: 6px;
  font-size: .82rem;
  color: var(--text);
  border: 1px solid var(--border);
}

/* ==========================================================================
   Include Tree
   ========================================================================== */
.tree-intro {
  font-size: .88rem;
  margin-bottom: .8rem;
}
.include-tree {
  list-style: none;
  padding-left: 1.4rem;
  border-left: 2px solid var(--border);
}
.tree-root {
  padding-left: 0;
  border-left: none;
}
.include-tree li { margin-top: .5rem; }
.tree-node {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}
.tree-domain {
  font-weight: 700;
  font-size: .9rem;
  color: var(--text);
}
.tree-record {
  display: block;
  width: 100%;
  margin-top: .25rem;
  padding: .4rem .7rem;
  background: var(--bg-input);
  border-radius: 6px;
  font-size: .78rem;
  color: var(--text-muted);
  word-break: break-all;
  white-space: pre-wrap;
  border: 1px solid var(--border);
}
.tree-no-record {
  font-size: .8rem;
  color: var(--critical);
  font-style: italic;
}
.tree-ip-count {
  font-size: .75rem;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: .15rem .5rem;
  border-radius: var(--radius-pill);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--bg-dark);
  text-align: center;
  padding: 1.5rem;
  margin-top: 2rem;
}
.site-footer p {
  font-size: .8rem;
  color: var(--text-light);
}
.site-footer a {
  color: var(--accent);
  font-weight: 500;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 720px) {
  .site-nav { display: none; }

  .hero h1 { font-size: 1.8rem; }
  .hero-sub { font-size: .95rem; }
  .hero { padding: 2.2rem 1rem 1.8rem; }

  .container { padding: 1.2rem 1rem 2rem; }
  .card { padding: 1.2rem; }

  .domain-form { flex-direction: column; }
  .domain-form button { width: 100%; padding: .8rem; }

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

  .score-row { grid-template-columns: 1fr; }
  .score-card { justify-content: flex-start; }

  .ip-grid { grid-template-columns: 1fr; }
  .ip-grid-v6 { grid-template-columns: 1fr; }
}
