/* time.crowny.org — tiomta.com 디자인 시스템 적용 */
*{margin:0;padding:0;box-sizing:border-box}

:root {
  --bg:          #FAF9F7;
  --bg-card:     #F4F1ED;
  --bg-hover:    #EEEAE4;
  --bg-input:    #FFFFFF;
  --bg-code:     #1E1E1E;

  --text:        #1A1A1A;
  --text2:       #6B6B6B;
  --text3:       #A0A0A0;

  --border:      #E5E2DD;
  --border2:     #D4D0C8;

  --accent:      #C9A961;
  --accent-dim:  #A08840;
  --accent-soft: rgba(201,169,97,0.10);
  --accent-glow: rgba(201,169,97,0.22);

  --t-color:     #22A06B;
  --o-color:     #C9A961;
  --a-color:     #D93025;
  --u-color:     #7C6CDB;

  --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:   0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:   0 12px 32px rgba(0,0,0,.13);

  --radius:      8px;
  --radius-lg:   12px;
  --radius-xl:   16px;

  --font: 'Pretendard Variable','Pretendard',-apple-system,BlinkMacSystemFont,'Segoe UI',system-ui,sans-serif;
  --mono: 'JetBrains Mono','SF Mono','Fira Code',Menlo,monospace;

  --ease:  cubic-bezier(0.4, 0, 0.2, 1);
  --t2:    200ms;
}

[data-theme="dark"] {
  --bg:          #080610;
  --bg-card:     #0C0A14;
  --bg-hover:    #1A1528;
  --bg-input:    #141020;
  --text:        #F0E8F8;
  --text2:       #8A7E98;
  --text3:       #5C5068;
  --border:      rgba(124,108,219,0.12);
  --border2:     rgba(201,169,97,0.22);
  --t-color:     #34d399;
  --a-color:     #ef4444;
  --u-color:     #8B7AE8;
}

html, body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-glow); color: var(--accent); }

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

button { font-family: var(--font); cursor: pointer; border: none; background: none; color: var(--text); }

/* === HEADER === */
.hdr {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 24px;
  padding: 14px 32px;
  background: rgba(250,249,247,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .hdr { background: rgba(8,6,16,0.85); }
.hdr-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 15px; letter-spacing: -0.02em;
  color: var(--text);
}
.hdr-logo {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--u-color), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: #fff;
  letter-spacing: -0.05em;
}
.hdr-nav { display: flex; gap: 4px; margin-left: auto; }
.hdr-nav a {
  padding: 6px 12px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; color: var(--text2);
  transition: all var(--t2) var(--ease);
}
.hdr-nav a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.hdr-nav a.active { color: var(--accent); background: var(--accent-soft); }
.hdr-theme {
  width: 32px; height: 32px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--text2);
  transition: all var(--t2) var(--ease);
}
.hdr-theme:hover { background: var(--bg-hover); color: var(--text); }

/* === LAYOUT === */
.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 32px 80px;
}

.hero {
  text-align: center;
  padding: 56px 0 48px;
}
.hero h1 {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 18px;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero .lead {
  font-size: 18px;
  color: var(--text2);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.5;
}

h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 48px 0 16px;
  display: flex; align-items: center; gap: 12px;
}
h2 .num {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-soft);
  padding: 4px 8px;
  border-radius: 6px;
}
h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 24px 0 10px;
}

p { margin-bottom: 14px; color: var(--text); }
p.muted { color: var(--text2); }

ul, ol { margin: 12px 0 16px 24px; }
li { margin-bottom: 6px; }

/* === CARDS === */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.card {
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--t2) var(--ease);
}
.card:hover { border-color: var(--border2); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card .label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text3);
  margin-bottom: 8px;
}
.card .big {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.card .desc { font-size: 13px; color: var(--text2); }

/* 4상 색상 카드 */
.card.t { border-top: 3px solid var(--t-color); }
.card.t .big { color: var(--t-color); }
.card.o { border-top: 3px solid var(--o-color); }
.card.o .big { color: var(--o-color); }
.card.a { border-top: 3px solid var(--a-color); }
.card.a .big { color: var(--a-color); }
.card.u { border-top: 3px solid var(--u-color); }
.card.u .big { color: var(--u-color); }

/* === TABLE === */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}
th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  font-weight: 600;
  color: var(--text2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-card);
}
td.num { font-family: var(--mono); text-align: right; }
tr:hover td { background: var(--bg-hover); }

/* === CODE === */
code {
  font-family: var(--mono);
  font-size: 13px;
  padding: 2px 6px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 4px;
}
pre {
  background: var(--bg-code);
  color: #d4d4d4;
  padding: 18px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  margin: 16px 0;
}
pre code { background: none; color: inherit; padding: 0; }

/* === CTA === */
.cta-row {
  display: flex; gap: 12px; justify-content: center;
  margin-top: 32px; flex-wrap: wrap;
}
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px; font-weight: 600;
  transition: all var(--t2) var(--ease);
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--accent); color: #fff;
}
.btn-primary:hover { background: var(--accent-dim); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary {
  background: var(--bg-card); color: var(--text); border-color: var(--border2);
}
.btn-secondary:hover { background: var(--bg-hover); text-decoration: none; }

/* === CALC === */
.calc {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  margin: 24px 0;
}
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.calc-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.calc-field input, .calc-field select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color var(--t2) var(--ease);
}
.calc-field input:focus, .calc-field select:focus { border-color: var(--accent); }
.calc-result {
  margin-top: 24px;
  padding: 24px;
  background: var(--bg-input);
  border-radius: var(--radius-lg);
  border-left: 3px solid var(--accent);
}
.calc-result .row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}
.calc-result .row:last-child { border-bottom: none; }
.calc-result .row .key { font-size: 13px; color: var(--text2); }
.calc-result .row .val { font-family: var(--mono); font-weight: 600; font-size: 16px; }
.calc-result .row.total .val { font-size: 28px; color: var(--accent); }

@media (max-width: 640px) {
  .page { padding: 24px 16px 60px; }
  .hero h1 { font-size: 32px; }
  .hero .lead { font-size: 16px; }
  .calc-grid { grid-template-columns: 1fr; }
  .hdr { padding: 12px 16px; gap: 12px; }
  .hdr-nav a { padding: 6px 8px; font-size: 12px; }
}

/* === RTL (Arabic) === */
[dir="rtl"] .hdr-nav { margin-left: 0; margin-right: auto; }
[dir="rtl"] table th, [dir="rtl"] table td { text-align: right; }
[dir="rtl"] td.num { text-align: left; }
[dir="rtl"] .card .label,
[dir="rtl"] .calc-field label { letter-spacing: 0; }
[dir="rtl"] .calc-result .row { flex-direction: row-reverse; }
[dir="rtl"] code, [dir="rtl"] pre { direction: ltr; text-align: left; }
[dir="rtl"] .calc-result { border-left: none; border-right: 3px solid var(--accent); }
[dir="rtl"] h2 .num { font-family: var(--mono); }
