/* variables */
:root {
  --color-text:#000;
  --color-bg:#ff962e;
  --color-border:#000;
  --color-button-bg:#000;
  --color-button-text:#fff;
  --max-width:1200px;
}

/* fonts */
@font-face {
  font-family: 'SourceSerif';
  font-style:  normal;
  src: url("../fonts/SourceSerif4-Regular.ttf") format("truetype");
}
@font-face {
  font-family: 'SourceSerif-Italic';
  font-style:  italic;
  src: url("../fonts/SourceSerif4-Italic.ttf") format("truetype");
}
@font-face {
  font-family: 'SourceSerif-Bold';
  font-style:  normal;
  src: url("../fonts/SourceSerif4-Bold.ttf") format("truetype");
}
@font-face {
  font-family: 'SourceSans-Regular';
  font-style:  normal;
  src: url("../fonts/SourceSans3-Regular.ttf") format("truetype");
}
@font-face {
  font-family: 'SourceSans-Bold';
  font-style:  normal;
  src: url("../fonts/SourceSans3-Bold.ttf") format("truetype");
}
@font-face {
  font-family: 'SourceSans-Italic';
  font-style:  italic;
  src: url("../fonts/SourceSans3-Italic.ttf") format("truetype");
}
@font-face {
  font-family: 'SourceCode';
  font-style:  normal;
  src: url("../fonts/SourceCodePro-VariableFont_wght.ttf") format("truetype");
}

/* base */
body {
  font-family: 'SourceSans-Regular', sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  margin: 0;
  padding: 0;
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
}

h1, h2, h3 {
  font-family: 'SourceSans-Regular', sans-serif;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  color: var(--color-text);
}

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

select, button, input {
  font-family: inherit;
  font-size: 1.1em;
  padding: 0.5em 1em;
  margin-right: 0.5em;
  border: 1px solid var(--color-border);
}

select {
  background: #fff;
  color: var(--color-text);
}

button {
  background: var(--color-button-bg);
  color: var(--color-button-text);
  cursor: pointer;
}
button:hover { opacity: 0.85; }

/* columns */
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  height: 100vh;
  width: 100vw;
}

.col {
  overflow-y: auto;
  padding: 2em;
  border-right: 1px solid var(--color-border);
}
.col:last-child { border-right: none; }

.col::-webkit-scrollbar { width: 5px; }
.col::-webkit-scrollbar-track { background: transparent; }
.col::-webkit-scrollbar-thumb { 
  background: rgba(0,0,0,0.2); 
  border-radius: 3px; 
}

/* col-1 */
.col-identity .logo { 
  max-height: 150px; 
  margin-bottom: 3em; 
}
.col-identity h1 { 
  font-size: 2em; 
  margin-top: 0; 
  line-height: 1.2; 
}
.col-identity h1 a { text-decoration: none; }
.col-identity .tagline { font-size: 1.05em; }
.col-identity .meta {
  margin-top: 2em;
  padding-top: 1.2em;
  border-top: 1px solid var(--color-border);
  font-size: 0.95em;
}

/* col-2 */
.col-heading { 
  font-size: 1.55em; 
  margin-top: 0; 
  margin-bottom: 0.2em; 
}
.col-sub { 
  font-size: 0.95em; 
  margin-bottom: 1.5em; 
}

.action-group { margin-bottom: 1.8em; }
.action-group-label {
  font-family: 'SourceSans-Regular', sans-serif;
  margin-bottom: 0.5em;
}
.action-group select { 
  width: 100%; 
  margin-right: 0; 
}

.btn-stack { 
  display: flex; 
  flex-direction: column; 
  gap: 0.45em; 
}
.btn-stack form { display: contents; }

.btn-stack button,
.btn-stack a.btn-link {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  text-decoration: none;
  font-family: inherit;
  font-size: 1.1em;
  padding: 0.5em 1em;
  border: 1px solid var(--color-border);
  cursor: pointer;
  box-sizing: border-box;
}

.btn-stack button {
  background: var(--color-button-bg);
  color: var(--color-button-text);
}

.btn-stack a.btn-link {
  background: var(--color-button-bg);
  color: var(--color-button-text);
}
.btn-stack a.btn-link:hover { opacity: 0.85; }

/* col-3 */
.file-list { 
  list-style: none; 
  padding-left: 0; 
  margin: 0; 
}
.file-item { position: relative; }
.file-item + .file-item { border-top: 1px solid rgba(0,0,0,0.12); }

.file-item a.file-link {
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.55em 0.4em;
  text-decoration: none;
  color: var(--color-text);
  transition: background 0.1s;
}
.file-item a.file-link:hover { background: rgba(0,0,0,0.06); }

.file-ext {
  width: 30px; height: 30px;
  background: rgba(0,0,0,0.08);
  display: flex; 
  align-items: center; 
  justify-content: center;
  font-family: 'SourceCode', monospace;
  font-size: 0.7em; 
  flex-shrink: 0;
}
.file-item a.file-link:hover .file-ext { background: rgba(0,0,0,0.15); }

.file-name {
  font-size: 1em; 
  flex: 1;
  overflow: hidden; 
  text-overflow: ellipsis; 
  white-space: nowrap;
}

.file-delete-btn {
  position: absolute; 
  right: 0.3em; 
  top: 50%; 
  transform: translateY(-50%);
  opacity: 0; 
  border: none; 
  background: none;
  color: var(--color-text); 
  cursor: pointer;
  font-size: 1.3em; 
  padding: 0.2em 0.4em;
  transition: opacity 0.12s;
}
.file-item:hover .file-delete-btn { opacity: 0.5; }
.file-delete-btn:hover { opacity: 1 !important; color: darkred; }

/* active css file highlight */
.file-link-active {
  background: rgba(0,0,0,0.08);
  font-family: 'SourceSans-Bold', sans-serif;
}

/* col-4 */
.util-section { margin-bottom: 2em; }
.util-section h3 { 
  margin-top: 0; 
  margin-bottom: 0.15em; 
}
.util-desc { 
  font-size: 0.9em; 
  margin-bottom: 0.7em; 
}

.util-section input[type="file"],
.util-section input[type="text"] {
  width: 100%; 
  margin-right: 0; 
  margin-bottom: 0.5em; 
  box-sizing: border-box;
}
.util-section button {
  width: 100%; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  gap: 0.5em;
}

.style-link {
  display: inline-flex; 
  align-items: center; 
  gap: 0.4em;
  font-size: 1.05em; 
  color: var(--color-text);
}

/* editor mode */
.col-editor {
  padding: 0;
  display: flex;
  flex-direction: column;
}

.editor-bar {
  background-color: var(--color-bg);
  padding: 1.2em 2em;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.editor-bar h2 { font-size: 1.35em; margin: 0 0 0.1em 0; }
.editor-bar h2 span {
  font-family: 'SourceSans-Regular', sans-serif;
  font-weight: normal;
}
.editor-hint { font-size: 0.88em; }

.editor-pane-label {
  background-color: var(--color-bg);
  font-family: 'SourceSans-Regular', sans-serif;
  padding: 0.5em 2em 0.5em; 
  flex-shrink: 0;
  border-bottom: 1px solid var(--color-border);
}

.col-editor textarea {
  flex: 1;
  font-family: 'SourceCode', monospace;
  font-size: 0.9em;
  line-height: 1.6;
  resize: none; 
  border: none; 
  outline: none;
  padding: 0 2em 2em;
  margin: -0.01px;
  background: #fff3e6;
  color: var(--color-text);
  width: 100%; height: auto;
  box-sizing: border-box;
}

.col-editor-preview { background: #fff; }

.col-editor-preview #preview {
  flex: 1; 
  overflow-y: auto;
  padding: 0 2em 2em;
  font-size: 1.02em; 
  line-height: 1.65;
  color: var(--color-text);
  height: auto; 
  width: auto; 
  border: none;
}
.col-editor-preview #preview::-webkit-scrollbar { width: 5px; }
.col-editor-preview #preview::-webkit-scrollbar-track { background: transparent; }
.col-editor-preview #preview::-webkit-scrollbar-thumb { 
  background: #ccc; 
  border-radius: 3px; 
}
.col-editor-preview #preview h1,
.col-editor-preview #preview h2,
.col-editor-preview #preview h3 { margin-top: 0.8em; }
.col-editor-preview #preview img { width: 150px; }

.code-editor {
  font-size: 0.9em !important;
}

/* css variable editor */
.var-row {
  display: flex;
  align-items: center;
  gap: 0.75em;
  margin-bottom: 0.6em;
}
.var-name {
  font-family: 'SourceCode', monospace;
  font-size: 0.82em;
  min-width: 0;
  word-break: break-all;
}
.var-input {
  display: flex;
  align-items: center;
  gap: 0.4em;
  flex: 1;
}
.var-input input[type="color"] {
  width: 36px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--color-border);
  cursor: pointer;
  flex-shrink: 0;
}
.var-input input[type="text"] {
  flex: 1;
  min-width: 0;
}

/* messages */
ul.messages { 
  list-style: none; 
  padding-left: 0; 
  margin-top: 1.5em; 
}
ul.messages li { 
  padding: 0.5em 0; 
  font-size: 0.95em; 
}
/* media query */
@media (max-width: 1100px) {
  body { 
    overflow: auto; 
    height: auto; 
  }
  .columns { 
    grid-template-columns: 1fr 1fr; 
    height: auto; 
  }
  .col { 
    min-height: 50vh; 
    border-bottom: 1px solid var(--color-border); 
  }
}
@media (max-width: 600px) {
  .columns { grid-template-columns: 1fr; }
  .col { min-height: auto; }
}
