/* StatutoryResidence.uk - Core Design System & Styling */
:root {
  --primary: #0f172a;        /* Deep Navy */
  --primary-light: #1e293b;  /* Slate Navy */
  --accent: #2563eb;         /* Royal Blue */
  --accent-hover: #1d4ed8;   /* Darker Royal Blue */
  --accent-gold: #d97706;    /* Amber Gold */
  --success: #059669;       /* Emerald Green */
  --warning: #eab308;       /* Amber */
  --danger: #dc2626;        /* Crimson Red */
  
  --bg-main: #f8fafc;        /* Soft Off-White */
  --bg-card: #ffffff;        /* Pure White */
  --bg-alt: #f1f5f9;         /* Muted Slate */
  
  --text-dark: #0f172a;      /* Charcoal / Black */
  --text-muted: #475569;     /* Muted Grey */
  --text-light: #94a3b8;     /* Light Grey */
  --border-color: #e2e8f0;   /* Light Border */
  --border-focus: #3b82f6;   /* Focus Outline */
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
  
  --font-heading: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-dark);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--primary);
  font-weight: 700;
  line-height: 1.25;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-hover);
}

/* Header & Nav */
.header-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1rem 0;
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  margin-right: 1rem;
}

.brand-logo img {
  height: 32px;
  width: auto;
  flex-shrink: 0;
}

.uk-pill {
  background: rgba(37, 99, 235, 0.25);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.35);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 50px;
  text-uppercase: uppercase;
  letter-spacing: 0.5px;
  margin-left: 0.5rem;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

.nav-links {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links li {
  display: flex;
  align-items: center;
}

.nav-links a {
  color: #cbd5e1;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}

.nav-links a:hover, .nav-links a.active {
  color: #ffffff;
}

.btn-cta {
  background: linear-gradient(135deg, var(--accent) 0%, #1d4ed8 100%);
  color: #ffffff !important;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--primary);
  border: 1px solid var(--border-color);
  font-weight: 600;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-secondary:hover {
  background: var(--bg-alt);
  border-color: var(--text-muted);
}

/* Hero Section */
.hero-section {
  background: linear-gradient(180deg, var(--primary) 0%, #1e293b 100%);
  color: #ffffff;
  padding: 5rem 1.5rem 6rem;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.15) 0%, rgba(0,0,0,0) 70%);
  pointer-events: none;
}

.hero-container {
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.35rem 1rem;
  border-radius: 50px;
  font-size: 0.85rem;
  color: #93c5fd;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(4px);
}

.hero-title {
  font-size: 3rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 1.25rem;
  letter-spacing: -0.03em;
}

.hero-title span {
  background: linear-gradient(135deg, #60a5fa 0%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: #94a3b8;
  max-width: 780px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 3rem;
  text-align: left;
}

.hero-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
}

.hero-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-3px);
}

.hero-card-icon {
  width: 44px;
  height: 44px;
  background: rgba(37, 99, 235, 0.2);
  color: #60a5fa;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 1rem;
}

.hero-card h3 {
  color: #ffffff;
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.hero-card p {
  color: #94a3b8;
  font-size: 0.92rem;
  line-height: 1.5;
}

/* Calculator Section */
.calculator-section {
  max-width: 1100px;
  margin: -4rem auto 4rem;
  padding: 0 1.5rem;
  position: relative;
  z-index: 10;
}

.calculator-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
}

.calc-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
}

.calc-title-box h2 {
  font-size: 1.75rem;
  margin-bottom: 0.35rem;
}

.calc-title-box p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.tax-year-badge {
  background: #eff6ff;
  color: var(--accent);
  border: 1px solid #bfdbfe;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.4rem 0.85rem;
  border-radius: 50px;
}

/* Calculator Form Elements */
.calc-step {
  display: none;
}

.calc-step.active {
  display: block;
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.step-indicator {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.step-dot {
  flex: 1;
  height: 6px;
  background: var(--bg-alt);
  border-radius: 3px;
  transition: all 0.3s ease;
}

.step-dot.active {
  background: var(--accent);
}

.step-dot.completed {
  background: var(--success);
}

.form-group {
  margin-bottom: 1.75rem;
}

.form-label {
  display: block;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.form-help {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.radio-group, .checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.option-card {
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--bg-card);
}

.option-card:hover {
  border-color: var(--accent);
  background: #f8fafc;
}

.option-card input[type="radio"],
.option-card input[type="checkbox"] {
  margin-top: 0.2rem;
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
}

.option-card.selected {
  border-color: var(--accent);
  background: #eff6ff;
  box-shadow: 0 0 0 1px var(--accent);
}

.option-text strong {
  display: block;
  color: var(--primary);
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.option-text span {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.35;
}

.input-number-box {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.input-number {
  width: 140px;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  outline: none;
  transition: border-color 0.2s;
}

.input-number:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.calc-footer {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Result Box */
.result-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 2rem;
  margin-top: 1.5rem;
}

.result-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.3rem;
  font-weight: 800;
  padding: 0.5rem 1.25rem;
  border-radius: 50px;
  margin-bottom: 1.25rem;
}

.status-non-resident {
  background: rgba(5, 150, 105, 0.2);
  color: #34d399;
  border: 1px solid rgba(5, 150, 105, 0.4);
}

.status-resident {
  background: rgba(220, 38, 38, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(220, 38, 38, 0.4);
}

.status-tie-dependent {
  background: rgba(234, 179, 8, 0.2);
  color: #fde047;
  border: 1px solid rgba(234, 179, 8, 0.4);
}

.result-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.breakdown-box {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
}

.breakdown-box .label {
  font-size: 0.8rem;
  color: #94a3b8;
  text-uppercase: uppercase;
  letter-spacing: 0.5px;
}

.breakdown-box .val {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  margin-top: 0.25rem;
}

.app-cta-banner {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.25) 0%, rgba(29, 78, 216, 0.35) 100%);
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-top: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.app-cta-text h4 {
  color: #ffffff;
  font-size: 1.15rem;
  margin-bottom: 0.35rem;
}

.app-cta-text p {
  color: #cbd5e1;
  font-size: 0.9rem;
}

/* General Layout Sections */
.section {
  padding: 4rem 1.5rem;
}

.section-alt {
  background-color: var(--bg-alt);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
}

.section-title {
  text-align: center;
  font-size: 2.25rem;
  margin-bottom: 0.75rem;
}

.section-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 720px;
  margin: 0 auto 3rem;
}

/* Feature Grid & Cards */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-uppercase: uppercase;
  color: var(--accent);
  background: #eff6ff;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.card h3 {
  font-size: 1.3rem;
  margin-bottom: 0.75rem;
}

.card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
  line-height: 1.6;
}

/* Sufficient Ties Table Matrix */
.matrix-container {
  overflow-x: auto;
  margin: 2rem 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  text-align: left;
}

.matrix-table th {
  background-color: var(--primary);
  color: #ffffff;
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.matrix-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.92rem;
}

.matrix-table tr:last-child td {
  border-bottom: none;
}

.matrix-table tr:nth-child(even) {
  background-color: var(--bg-main);
}

.badge-resident {
  background: #fee2e2;
  color: #991b1b;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.badge-nonresident {
  background: #d1fae5;
  color: #065f46;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* Comparison Table styling for Article */
.comparison-table-wrapper {
  overflow-x: auto;
  margin: 2.5rem 0;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
}

.comp-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
}

.comp-table th {
  background: var(--primary);
  color: #ffffff;
  padding: 1.25rem 1rem;
  font-size: 0.95rem;
}

.comp-table th.highlight-col {
  background: var(--accent);
}

.comp-table td {
  padding: 1.1rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.92rem;
}

.comp-table td.feature-name {
  text-align: left;
  font-weight: 600;
  color: var(--primary);
}

.comp-table td.highlight-cell {
  background: #f0f9ff;
  font-weight: 700;
}

.check-icon {
  color: var(--success);
  font-size: 1.25rem;
  font-weight: bold;
}

.cross-icon {
  color: var(--danger);
  font-size: 1.25rem;
  font-weight: bold;
}

/* Article Styles */
.article-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

.article-header {
  margin-bottom: 3rem;
  text-align: left;
}

.article-meta {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 1rem 0 2rem;
  flex-wrap: wrap;
}

.article-content {
  font-size: 1.05rem;
  line-height: 1.8;
  color: #334155;
}

.article-content h2 {
  font-size: 1.85rem;
  margin: 2.5rem 0 1rem;
}

.article-content h3 {
  font-size: 1.4rem;
  margin: 2rem 0 0.85rem;
}

.article-content p {
  margin-bottom: 1.5rem;
}

.article-content ul, .article-content ol {
  margin-bottom: 1.75rem;
  padding-left: 1.75rem;
}

.article-content li {
  margin-bottom: 0.6rem;
}

.callout-box {
  background: #f0f9ff;
  border-left: 4px solid var(--accent);
  padding: 1.5rem;
  border-radius: var(--radius-sm);
  margin: 2rem 0;
}

.callout-box h4 {
  color: var(--primary);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.callout-box p {
  margin-bottom: 0;
  font-size: 0.98rem;
}

/* Footer */
footer {
  background-color: var(--primary);
  color: #94a3b8;
  padding: 4rem 1.5rem 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-container {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-col h4 {
  color: #ffffff;
  font-size: 1.05rem;
  margin-bottom: 1.25rem;
}

.footer-col ul {
  list-style: none;
}

.footer-col li {
  margin-bottom: 0.75rem;
}

.footer-col a {
  color: #cbd5e1;
  font-size: 0.9rem;
}

.footer-col a:hover {
  color: #ffffff;
}

.footer-bottom {
  max-width: 1100px;
  margin: 0 auto;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  font-size: 0.85rem;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2.2rem;
  }
  .nav-links {
    display: none;
  }
  .calculator-card {
    padding: 1.5rem;
  }
  .calc-header {
    flex-direction: column;
  }
  .app-cta-banner {
    flex-direction: column;
    text-align: center;
  }
}
